https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose
  • r

    Rafs

    11/23/2020, 7:10 PM
    How do I manually change the
    sheetpeekHeight
    of a
    BottomSheetScaffold
    composable? I tried passing a state variable and modifying it but it has no effect
    ✅ 1
    d
    3 replies · 2 participants
  • l

    loloof64

    11/23/2020, 8:23 PM
    Hi again : what is a simple way to center a component ? Either horizontally/vertically/in both directions ? I can't manage to handle centering carefully...
    k
    3 replies · 2 participants
  • k

    Kshitij Patil

    11/24/2020, 5:18 AM
    Has anyone used Crossfade with navigation compose? I want Crossfade to be shown only once and in later cases like
    onResume
    , the screen should be shown directly. How can I achieve this?
    i
    1 reply · 2 participants
  • c

    chao

    11/24/2020, 7:37 AM
    Getting this secret error message on compose 1.0.0-alpha07, any suggestions?
    org.jetbrains.kotlin.diagnostics.SimpleDiagnostic@676ce3fe (error: could not render message)
    h
    3 replies · 2 participants
  • s

    sashjakk

    11/24/2020, 10:08 AM
    Hello, I’ve been playing around with lazy column and scroll positions. I am able to get first visible item & it’s offset … but nothing about last visible item 🤔 adding scrollable modifier throws an exception with nested scrolling not allowed 😅 any ideas how to get last visible item & offset ? Or maybe its possible to calculate by hand at least? I need to draw some shadows for toolbar and bottom bar based on scrolling
    a
    3 replies · 2 participants
  • l

    loloof64

    11/24/2020, 10:39 AM
    Hi, how can I actually convert a size in Dp to a size in Px in a composable ? I mean :
    @Composable
    MyComposable(size: Dp) {
    // how to get size in px ?
    }
    Because it seems that
    withDensity
    is not available in the newest API.
    a
    2 replies · 2 participants
  • g

    Geert

    11/24/2020, 10:51 AM
    Are there no standard function to receive files from the resources folder? I have some json files included, but I can only find functions for imageassets, not for text.
    j
    a
    +1
    12 replies · 4 participants
  • e

    escodro

    11/24/2020, 11:21 AM
    Hello! Should we avoid using
    ViewModel
    in brand new Android projects or projects that we are able to refactor this part? I'm asking this because Compose seems to be growing over the Android Environment and I saw some projects using
    ViewModel
    and other ignoring it.
    s
    j
    +3
    12 replies · 6 participants
  • g

    Grzegorz Baczek

    11/24/2020, 3:01 PM
    Hey. Not sure if this is bug or it is working as intended so I decided to post it here. So my case is that I'm using
    LazyRowFor
    with elements whose width is equal to window width. And I'm trying to get currently visible item on the screen by using
    rememberLazyListState()
    with
    firstVisibleItemIndex
    . The problem is that whenever I reach the end of the list, this index is not updated. So the second to last item is fully hidden and only the last one is visible, but it still indicates second to last item. I've worked around it by adding 1 dp to the items width but it doesn't seem right. Also I've got question: is it possible in this case to make items adjust their position after each fling to the start of the screen? For example 3rd item is visible on the screen, I swipe from right to left and then 4th item enters from right side and gets snapped to the start of the screen, so it fill whole screen width.
    a
    2 replies · 2 participants
  • l

    loloof64

    11/24/2020, 5:01 PM
    Hi again, in this Composable (I am calling it with MyComposable(Modifier.size(100.dp) for example)
    @Composable
    fun MyComposable(modifier: Mofifier) {
        Column(modifier = modifier.background(backgroundColor)) {
            (0 until 8).forEach { row ->
                val color = if (row%2 == 0) whiteCellColor else blackCellColor
                Row(modifier = Modifier.size(10.dp).background(color)) { // Here how to get a ration of 0.111 of the Composable size rather than a fixed 10dp Size ? 
    
                }
            }
        }
    }
    How can make the
    size(10.dp)
    (see the comment) be a ratio of the parent instead ?
    a
    12 replies · 2 participants
  • l

    loloof64

    11/24/2020, 7:49 PM
    Can anybody tell me what's wrong with the following component ? It should be made of two colors : a purple background and a brown line at top. Instead, all I can see is a purple square.
    @Composable
    fun SimpleZone(modifier: Modifier) {
        val backgroundColor = Color(0xCAD63B60) // purple
        val cellColor = Color(0xFFFFCE9E) // brown
        
        Column(modifier = modifier.background(backgroundColor)) {
            Row(modifier = Modifier.fillMaxHeight(0.1f).background(cellColor)) {
    
            }
        }
    }
    
    @Preview
    @Composable
    fun SimpleZonePreview() {
        SimpleZone(modifier = Modifier.size(100.dp))
    }
    n
    a
    12 replies · 3 participants
  • a

    Arun

    11/24/2020, 9:02 PM
    Trying to use
    .preferredHeight(IntrinsicSize.Min)
    . Getting the following error if a Composable using it is inside ScrollableColumn:
    java.lang.IllegalStateException: Intrinsic measurements are not currently supported by SubcomposeLayout
    Any idea what this is and how to get around this? I’m currently on alpha07.
    a
    8 replies · 2 participants
  • l

    loloof64

    11/25/2020, 12:21 AM
    Hi again, this is a composable I am building. Is it possible to make the coordinates' font size adapt to the size of their different "boxes" ? I mean, can I make the font size be a ratio of the available space for a given letter text ? (I've put some comments in order to locate the issue)
    @Composable
    fun StaticChessBoard(
        modifier: Modifier = Modifier,
        positionFen: String = standardStartFen
    ) {
        val backgroundColor = Color(0xCAD63B60)
        val whiteCellColor = Color(0xFFFFCE9E)
        val blackCellColor = Color(0xFFD18B47)
        val textColor = Color(0xFFFFCC00)
    
        val filesCoordinates = arrayListOf("A", "B", "C", "D", "E", "F", "G", "H")
        val rankCoordinates = arrayListOf("8", "7", "6", "5", "4", "3", "2", "1")
    
        Column(
            modifier = modifier
                .background(backgroundColor),
            verticalArrangement = Arrangement.Center,
        ) {
    
            Row(modifier = Modifier
                .fillMaxWidth(0.8888f)
                .weight(1f)
                .align(Alignment.CenterHorizontally)) {
                (0 until 8).forEach { col ->
                    val text = filesCoordinates[col]
    // Can I adapt the size here ?
                    Text(text, color = textColor, fontWeight = FontWeight.Bold, modifier = Modifier.weight(1f))
                }
            }
    
            Column(
                modifier = Modifier.fillMaxWidth().weight(8f),
            ) {
    
                (0 until 8).forEach { row ->
                    Row(
                        modifier = Modifier
                            .fillMaxWidth(0.8888f)
                            .weight(1f)
                            .align(Alignment.CenterHorizontally)
                    ) {
                        (0 until 8).forEach { col ->
                            val color = if ((col + row) % 2 == 0) whiteCellColor else blackCellColor
                            Column(
                                modifier = Modifier
                                    .fillMaxHeight()
                                    .weight(1f)
                                    .background(color)
                            ) {
    
                            }
                        }
                    }
                }
            }
    
            Row(modifier = Modifier
                .fillMaxWidth(0.8888f)
                .weight(1f)
                .align(Alignment.CenterHorizontally)) {
                (0 until 8).forEach { col ->
                    val text = filesCoordinates[col]
    // Can I adapt the size here ?
                    Text(text, color = textColor, fontWeight = FontWeight.Bold, modifier = Modifier.weight(1f))
                }
            }
        }
    }
    
    @Preview
    @Composable
    fun StaticChessBoardPreview() {
        StaticChessBoard(
            modifier = Modifier.size(100.dp),
            positionFen = "rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2\n"
        )
    1 reply · 1 participant
  • b

    Bradleycorn

    11/25/2020, 2:35 AM
    Anyone ever run into trouble with
    AndroidView
    and/or
    WebView
    ? I have a composable that is a
    Column
    with a few
    Text
    and
    Image
    Composables, and then an
    AndroidView
    which loads a
    WebView
    … When it loads, the AndroidView/WebView display fine (and in the proper spot on the screen), but the other Text and Image composables don’t show up at all. Anyone run into this issue? If I comment out the AndroidView, then the Text and Image composables show up. Also, if I use an AndroidView, but just load it with a generic
    View
    , then the Text and Image composables also show up. So it seems to be something specific to WebView? More strange, if I DO NOT use androidx.webkit for the WebView, then if I wait a while after the screen loads up (maybe 20 or 30 seconds?) and then scroll around in the webview, the content then all of a sudden pops into place
    🙋‍♂️ 1
    t
    1 reply · 2 participants
  • m

    Mehdi Haghgoo

    11/25/2020, 5:19 AM
    I want to back my Compose app's viewmodel with Room and I'm trying to use Room+Kotlin codelab, which seems to have been changed a bit since it was first written. In my ViewModel,
    asLiveData()
    is not understood.
    Unresolved reference
    asLiveData
    class CostViewModel(private val repository: CostRepository): ViewModel() {
    
        val costs : LiveData<List<Cost>> = repository.costs.asLiveData()
    
        fun addCost(vararg cost: Cost) = viewModelScope.launch{
            repository.addCost(*cost)
        }
    }
    
    
    class CostViewModelFactory(private val repository: CostRepository) : ViewModelProvider.Factory {
        override fun <T : ViewModel> create(modelClass: Class<T>): T {
            if (modelClass.isAssignableFrom(CostViewModel::class.java)) {
                @Suppress("UNCHECKED_CAST")
                return CostViewModel(repository) as T
            }
            throw IllegalArgumentException("Unknown ViewModel class")
        }
    }
    My Repo:
    import kotlinx.coroutines.flow.Flow
    
    class CostRepository(private val costDao: CostDao){
        val costs: Flow<List<Cost>> = costDao.getCosts()
    
    
        suspend fun addCost(vararg cost: Cost){
            costDao.addCost(*cost)
        }
    
        suspend fun deleteCosts(vararg cost: Cost){
            costDao.deleteCost(*cost)
        }
    }
    My Dao:
    @Dao
    interface CostDao {
        @Query("SELECT * FROM cost")
        fun getCosts(): Flow<List<Cost>>
    
        @Insert()
        suspend fun addCost(vararg cost: Cost)
    
        @Delete()
        fun deleteCost(vararg cost: Cost)
    }
    k
    1 reply · 2 participants
  • a

    Ananiya

    11/25/2020, 5:29 AM
    Hello there, i am unable to download "kotlin-complier-embedable-$vers-dev-withExperimental.." Compose Library in android studio due to network unstablity causing read timeout, so I have download it with chrome, but where should I locate it Please help
    a
    6 replies · 2 participants
  • m

    MBegemot

    11/25/2020, 7:05 AM
    Has anybody stumbled into this ->java.lang.IllegalStateException: Missed recording an endGroup, the problem is that the exception happens randomly, and it's hard to debug, what does it mean? thanks a lot
    n
    2 replies · 2 participants
  • k

    kevin_abrioux

    11/25/2020, 8:18 AM
    Hi guys, any idea how to manage accessibility on Compose, like
    setContentDescription
    ?
    a
    z
    2 replies · 3 participants
  • l

    loloof64

    11/25/2020, 9:32 AM
    Hi ! Is there a simple way to convert size (is given as dp) to sp unit ?
    val cellsSize = with(DensityAmbient.current) {
       (size.toIntPx() * 0.1111) // Can I convert this result (which is px in Int) into an Sp unit, for a text ?
    }
    I've been searching at https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/package-summary. But did not find which one could be useful.
    a
    5 replies · 2 participants
  • m

    Manuel Lorenzo

    11/25/2020, 12:59 PM
    hi everybody, how do you guys show and hide a progress indicator while some data is being loaded?
    k
    p
    +1
    10 replies · 4 participants
  • g

    grandstaish

    11/25/2020, 1:52 PM
    I have a Column with 8dp vertical padding, and two text children. One text has a line height of 24sp, and the other 16sp. 8+24+16+8=56, yet the total height of the container is just under 60dp. Where exactly does the extra ~4dp come from?
    l
    a
    4 replies · 3 participants
  • l

    loloof64

    11/25/2020, 1:57 PM
    Hi ! Is there an equivalent of DrawVector in compose 1.0.0-alpha06 ?
    a
    3 replies · 2 participants
  • x

    xetra11

    11/25/2020, 2:44 PM
    Can sb. tell me the differenence between:
    Jetpack Compose
    vs
    JetBrains Compose Android/JVM/Multiplatform
    a
    1 reply · 2 participants
  • s

    Siyamed

    11/25/2020, 3:03 PM
    A short poll. Which name is better for annotated string builder? • annotatedString(lambda) vs • buildAnnotatedString(lambda)
    1️⃣ 3
    2️⃣ 25
    e
    k
    3 replies · 3 participants
  • b

    Bradleycorn

    11/25/2020, 3:53 PM
    Have I found a defect with
    AndroidView
    when used with a
    WebView
    , or am I doing something wrong? I have the following Composables that setup a screen containing a Column with some images and text, and then an AndroidView with a WebView. When the screen is composed, None of the top composables seem to get rendered, including the root level Surface that draws the entire screen with a dark background color (I have darkmode enabled). The ONLY thing that gets rendered is the AndroidView/WebView … Oddly enough, if I scroll in the WebView a little bit, all of a sudden the top views and Surface are rendered and magically appear ( have checked, nothing is recomposed, they just all of a sudden get rendered). Have I done something wrong, or is this a defect? Here are my composables:
    @Composable
    fun PostContent(post: Post, postContent: String) {
       Column {
            PostImage(url = post.imageUrl)
            Column(modifier = Modifier.padding(horizontal = 16.dp)) {
                Spacer(modifier = Modifier.height(8.dp))
                Providers(AmbientContentAlpha provides ContentAlpha.high) {
                    Text(
                        text = post.title,
                        style = MaterialTheme.typography.h5,
                        color = MaterialTheme.colors.primaryOnSurface
                    )
                }
                Spacer(modifier = Modifier.height(8.dp))
                Row(modifier = Modifier.padding(vertical = 8.dp)) {
                    CoilImage(
                        data = post.authorImage ?: "",
                        requestBuilder = {
                            transformations(CircleCropTransformation())
                        },
                        modifier = Modifier.width(36.dp).height(36.dp)
                            .align(Alignment.CenterVertically),
                        contentScale = ContentScale.Fit
                    )
    
                    Column(modifier = Modifier.padding(horizontal = 8.dp)) {
                        Text(text = post.author)
                        Providers(AmbientContentAlpha provides ContentAlpha.medium) {
                            Text(text = post.datePosted.toString("MMMM dd, h:mm a"))
                        }
                    }
                }
                Spacer(modifier = Modifier.height(8.dp))
                PostBody(postContent)
            }
    
        }
    }
    
    
    @SuppressLint("SetJavaScriptEnabled")
    @Composable
    fun PostBody(html: String, modifier: Modifier = Modifier) {
        val darkModeEnabled = !MaterialTheme.colors.isLight
    
        AndroidView(viewBlock = { context ->
            WebView(context).apply {
                webViewClient = WebViewClient()
                settings.javaScriptEnabled = true
                settings.loadWithOverviewMode = true
                settings.useWideViewPort = true
                isVerticalScrollBarEnabled = false
                setBackgroundColor(context.getColorFromAttr(R.attr.colorSurface))
                if (darkModeEnabled) {
                    if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
                        WebSettingsCompat.setForceDark(settings, WebSettingsCompat.FORCE_DARK_ON);
                    }
                }
                if(WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK_STRATEGY)) {
                    WebSettingsCompat.setForceDarkStrategy(settings, WebSettingsCompat.DARK_STRATEGY_USER_AGENT_DARKENING_ONLY);
                }
            }
        },
        update = {
            it.loadDataWithBaseURL("file:///android_asset/", html, "text/html", "base64", null)
        })
    }
    👍 3
    a
    9 replies · 2 participants
  • l

    loloof64

    11/25/2020, 7:50 PM
    Hi ! Is there a way to get available size somewhere in the Composable tree ? (See the comment) Because in a Composable I made, I could not rely on a Modifier, I really needed to get the size as a parameter.
    @Composable
    fun GameScreen(topLevelNavController: NavController) {
        GameScreenTheme {
            Scaffold(
                topBar = {
                    TopAppBar(
                        title = {
                            Text(
                                stringResource(id = R.string.game_page),
                            )
                        },
                        navigationIcon = {
                            IconButton(onClick = {
                                topLevelNavController.popBackStack()
                            }) {
                                Icon(Icons.Filled.ArrowBack)
                            }
                        }
                    )
                },
            ) {
                // Is there a way to get available width and height ?
            }
        }
    }
    b
    a
    +1
    21 replies · 4 participants
  • t

    Timo Drick

    11/25/2020, 8:27 PM
    Is there a memory leak in remember function? Because in the following code finalize is never called? Or did i something wrong?
    data class Test(val pos: Int) {
        protected fun finalize() {
            log("Test finalized: $pos")
        }
    }
    class MainActivity : ComponentActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContent {
                var pos by remember { mutableStateOf(0) }
                Box(Modifier.fillMaxSize().clickable { pos++ }) {
                    val test = remember(pos) { Test(pos) }
                    Text("${test.pos}")
                    onCommit {
                        log("Test: $pos commited")
                        onDispose {
                            log("Test: $pos disposed")
                        }
                    }
                }
            }
        }
    }
    s
    g
    13 replies · 3 participants
  • j

    Jeisson Sáchica

    11/25/2020, 8:34 PM
    Hi guys! One questions relating compose navigation. Is there a special way to navigate to a nested
    navigation
    defined in the
    NavHost
    ? I am currently getting an error stating the the NavDeepLink cannot be found when navigating from a
    composable
    5 replies · 1 participant
  • s

    Sebastian Neagrau

    11/25/2020, 10:41 PM
    Hey guys! Im new to Android, and Jetpack Compose for that matter, and I was wondering if I can use multiple activities with Jetpack compose, because what I’ve seen from the Compose Examples, most of the applications (if not all of them) have a single main activity, and they handle navigation with NavHosts and NavControllers. If it is possible though to use multiple Activities, when should I make a new Activity? (Also should fragments be used with Jetpack compose?)
    c
    a
    9 replies · 3 participants
  • h

    Halil Ozercan

    11/25/2020, 11:16 PM
    I'm doing something kind of hacky and introducing a weird tree in compose that looks like the following: "Column [ AndroidView [ FrameLayout [ setContent @Composable[ TextField ] ] ] ] ". Now, when I click and try to type on this textfield that resides in a framelayout which resides in an AndroidView Composable, an exception is thrown.
    java.lang.IllegalStateException: KeyEvent can't be processed because this key input node is not active.
    Is this worthy of filing a bug? Or is it too weird of a use case? Should compose never be entangled in different layers with the old View system like this?
    a
    a
    5 replies · 3 participants
Powered by Linen
Title
h

Halil Ozercan

11/25/2020, 11:16 PM
I'm doing something kind of hacky and introducing a weird tree in compose that looks like the following: "Column [ AndroidView [ FrameLayout [ setContent @Composable[ TextField ] ] ] ] ". Now, when I click and try to type on this textfield that resides in a framelayout which resides in an AndroidView Composable, an exception is thrown.
java.lang.IllegalStateException: KeyEvent can't be processed because this key input node is not active.
Is this worthy of filing a bug? Or is it too weird of a use case? Should compose never be entangled in different layers with the old View system like this?
a

Adam Powell

11/25/2020, 11:17 PM
yes, worthy of filing a bug
👍 1
a

allan.conda

11/26/2020, 4:02 AM
There’s a bug filed for that already. I think it’s fixed for next release
https://issuetracker.google.com/issues/165034731
h

Halil Ozercan

11/26/2020, 6:34 AM
@allan.conda thanks for the link
a

allan.conda

11/26/2020, 6:38 AM
Btw, I don’t think it’s a weird use case. The main use case of Compose right now is to integrate with existing code, over writing purely compose apps. Or at least that’s what I heard somewhere I can’t remember where from.
View count: 2