https://kotlinlang.org logo
Join Slack
Powered by
# compose-android
  • g

    galex

    08/07/2025, 2:33 PM
    Are there any news on the progress of implementation of deep links and a Result API in
    nav3
    , by any chance?
    👀 1
  • p

    Pablichjenkov

    08/07/2025, 11:34 PM
    Many of us have been questioning about nesting the
    NavDisplay
    composable from the new Navigation3 library. Here is some code trying that out and it works like a charm! Is not the recommended way to use this library but in case there is no other alternative for a quick solution. Here it is: https://github.com/pablichjenkov/nav3-playground The demo basically consist of one
    NavDisplay
    for the most top BottomBarNavigation and another
    NavDisplay
    inside the third tab, hosted in a ModalDrawer.
    • 1
    • 1
  • m

    Mark

    08/10/2025, 9:13 AM
    On some obscure devices
    painterResource(Int)
    throws a “Error attempting to load resource:” exception (the resource ID is declared as a placeholder in some common module and then provided in some higher level module, and it seems that some weird devices don’t like that). This particular image isn’t important so I’d like to just show blank space when it fails. However, since we can’t use try/catch around composable functions, how to deal with this? EDIT: I suppose I could just test using
    ImageBitmap.imageResource(res, id)
    but since this is a rare case I don’t want to do it every time, only as a fallback.
  • d

    David Rubio

    08/10/2025, 4:28 PM
    Is it possible to implement something like a Google Calendar day view? i.e. a container for cards sparsely distributed, with a grid-like background, with (vertical only) kinetic scrolling, two finger scrolling, and (also vertical) zoom? This looks simpler than it is IMHO.
    r
    • 2
    • 2
  • f

    flamy

    08/11/2025, 10:23 AM
    Hi all, is it bad practice to use
    weight(1f)
    inside a Scrollable Column? I tested the app and it works fine according to my requirements. The app is also not crashing nor lagginggratitude thank you
    s
    • 2
    • 2
  • u

    Uberunix

    08/14/2025, 12:16 PM
    For all of the Compose Basics course up to this point, I've been instructed to define state like
    Copy code
    var amountInput by remember {mutableStateOf()}
    However, in a new unit, I'm being directed to write it differently with no explanation.
    Copy code
    var amountInput: MutableState<String> = mutableStateOf("0")
    Is there an appreciable between these two idioms? Are there use-cases specific to each?
    m
    z
    +2
    • 5
    • 9
  • t

    Tiago Nunes

    08/14/2025, 1:22 PM
    Anyone else having an issue with Gitlab Gemnasium Dependency Scanning complaining that
    project has unresolved dependencies: ["androidx.compose.ui:ui-tooling" "androidx.compose.ui:ui-test-manifest"]
    , after adding Compose? I believe this may be a bug in the Gitlab runner resolving dependencies declared with debugImplementation, but I can't find anyone online who's facing the same issue.
  • b

    Bradleycorn

    08/14/2025, 8:15 PM
    Hi everyone. I was wondering if anyone has created (or knows how to create) what I call a "Spreadsheet View" in Compose. Basically it's a grid (bonus points for a lazy grid) that can be scrolled horizontally and vertically, and it has a header row that is sticky when scrolled vertically, as well as a header column that is sticky when scrolled horizontally. In my case it's ok for all grid cells to be a fixed width and height. I built this in the old view system a long time ago. It was a HUGE pain. I basically had to create 3 RecyclerViews (one for the header row, one for the header column, and one for the grid of data) and keep their scroll positions in sync. For the grid of data, I had to create a custom RecylerView.LayoutManager. Like I said, a HUGE pain. Below is a video of it working in the old view system. I'm not sure how I could achieve this with Compose? I asked this question a year or two ago, and got several "can't do it currently" answers. Wondering if that is still the case...
    spreadsheet_grid.webm
    w
    e
    j
    • 4
    • 7
  • c

    Colton Idle

    08/14/2025, 10:17 PM
    Maybe dumb question but is
    Copy code
    @Composable
    fun Foo(){
    val myFont = FontFamily(Font(`R.font.myfont`))
    ...
    }
    bad? Should be wrapped in a remember?
    s
    a
    • 3
    • 9
  • s

    Seri

    08/15/2025, 4:22 PM
    https://www.promobile.dev/news/jetpack-compose-august-25-release
    r
    • 2
    • 2
  • m

    Matti MK

    08/18/2025, 10:32 AM
    I've added the M3 SearchBar component to my project. When entering a screen with the
    SearchBar
    component I get the following crash:
    Copy code
    java.lang.NoSuchMethodError: No static method SearchBar-Y92LkZI(Lkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function1;Landroidx/compose/ui/Modifier;Landroidx/compose/ui/graphics/Shape;Landroidx/compose/material3/SearchBarColors;FFLandroidx/compose/foundation/layout/WindowInsets;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;II)V in class Landroi
    I've got no issues with other M3 components I've tried. Running Compose BOM
    2025.05.01
    , nav3, M3 adaptive. I've tried to look for this in the IssueTracker, but no luck there. Any suggestions?
    s
    • 2
    • 13
  • o

    oday

    08/18/2025, 3:19 PM
    Hey guys, do you know how we can check if contentdescription in modifier semantic is not empty? for more context: imagine I want to have a component that can receive modifier and also label. if you give content description in modifier we should use that one for talkback otherwise we use label one.
    z
    a
    • 3
    • 4
  • e

    eygraber

    08/18/2025, 10:33 PM
    Is the
    entryProvider
    DSL in nav3 supposed to be
    remembered
    or is it not worth it?
    👀 1
  • a

    Alex Styl

    08/19/2025, 4:02 AM
    Are soft keyboards somehow tied to the current window on android? I am trying to use Compose's
    LocalSoftwareKeyboardController
    but I can't dismiss the keyboard from a modal/dialog if the reference of the SoftwareKeyboardController was taken from outside of the dialog's scope.
    a
    • 2
    • 5
  • s

    shock 11

    08/19/2025, 7:53 PM
    Hello Guys, in the detectTapGestures function for compose, if we are listening to two events like onTap and onPress, it seems anytime the user presses on the screen and lifts their finger(I understand that the onPress callback is triggered) the onTap callback is triggered, instead of only onPress, and vice versa. My question is that, is there any refined or out of the box way to make the onTap gesture stop getting triggered when we call the onPress(and the user lifts their finger) and vice versa?
    • 1
    • 1
  • a

    Adrian Landborn

    08/21/2025, 7:26 AM
    I just updated Compose, Gradle and Kotlin plugin. Compose BOM went from 2025.06.01 -> 2025.08.00. Now like 30% of all out Unit tests started to fail. Anyone else experienced this? 🧵
    a
    • 2
    • 3
  • a

    Abhimanyu

    08/22/2025, 10:32 AM
    Hi all 👋 , For Compose Previews, should they be added to the
    main
    source set or the
    debug
    source set? Pros and Cons I could see:
    main
    Pros - Can preview any composable (
    public, internal and private
    ) Cons - Preview methods are included in the final source code, which is not required.
    debug
    Pros - Preview methods are NOT included in the final source code. Cons - Can not preview
    private
    Composables as they are inaccessible from
    debug
    source set. I am referring to methods that contain code only for preview purposes. E.g.
    Copy code
    @Preview
    @Compose
    fun GreetingPreview() {
      Greeting("Hello Compose!")
    }
    solved 1
    s
    • 2
    • 4
  • c

    Colton Idle

    08/23/2025, 5:22 PM
    Should state ever be exposed like this?
    Copy code
    private val _isInitialized = mutableStateOf(false)
        val isInitialized: State<Boolean> = _isInitialized
    👀 1
    t
    c
    +8
    • 11
    • 28
  • l

    luke_c

    08/27/2025, 7:43 AM
    We have an
    AndroidView
    which reads from a lambda passed into the function, which is stable
    Copy code
    AndroidView(factory = { context -> 
        onViewCreated()
        ...
      }
    )
    However this is causing the factory function to be called, and the underlying view to be re-created on every configuration change. The lambda is ultimately created this way:
    Copy code
    val onViewEvent = remember(viewModel) { viewModel::onViewEvent }
    val onViewCreated = { onViewEvent(SomeViewEvent) }
    The problem I'm seeing is that
    remember
    doesn't survive configuration changes, so
    onViewEvent
    gets remember'd again with a new reference (even though the viewModel instance is the same) and we can't use
    rememberSaveable
    with lambdas (and I'm not sure it feels right to do so!) Has anyone dealt with this before and figured out a solution?
    j
    u
    • 3
    • 3
  • m

    Mofe Ejegi

    08/28/2025, 5:02 PM
    I'm having a problem with
    rememberSaveable
    inputs. I assumed it's meant to work just like
    remember
    keys or like
    LaunchedEffect
    keys where any change in any of the keys would trigger a re-calculation or re-run of the init block. But for some reason, it does't always run - it gives inconsistent results across different devices, and sometimes even on the same device. Take a look at this code below, why does the print statement in the
    LaunchedEffect
    and the
    remember
    block work, but not the
    rememberSaveable
    ?
    Copy code
    val density = LocalDensity.current
        val d = density.density
        val f = density.fontScale
    
        println("Density: $d, Font Scale: $f")
    
        LaunchedEffect(d, f) {
            println("Screen density changed, resetting content height")
        }
    
        val testRememberHeight by remember(d, f) {
            println("Recalculating test height")
            mutableFloatStateOf(0f)
        }
    
        val contentHeightDp by rememberSaveable(d, f) {
            println("Recalculating content height")
            mutableFloatStateOf(0f)
        }
    Am I doing something wrong? Perhaps the way I'm changing the density (using the Android Studio Emulator quick tools) isn't the correct way? Though I clearly see the logs printed indicating the Density and Scale changing.
    z
    • 2
    • 7
  • l

    louiscad

    09/01/2025, 1:44 PM
    Hello, Why was this issue closed? https://issuetracker.google.com/issues/294046936 Both of these are *zero height*(!) when in a
    Column
    with the
    verticalScroll
    modifier than can scroll (i.e. content longer than the parent):
    Copy code
    Spacer(Modifier.weight(1f).heightIn(min = 16.dp))
    
    Spacer(Modifier.weight(1f).requiredHeightIn(min = 16.dp))
    I have found NO working workaround. There's also an abandoned issue on YouTrack: https://youtrack.jetbrains.com/issue/CMP-4212
    l
    c
    +5
    • 8
    • 31
  • j

    Jojo C

    09/04/2025, 4:06 AM
    Has anyone try the new Compose Autofill API and work with the semantic Modifier with
    contentType
    ? I have tried it and it works with Google Password Manager and Bitwarden, it works, but not with Samsung Pass.
    s
    z
    c
    • 4
    • 6
  • i

    Irsath Kareem

    09/08/2025, 10:58 AM
    collectAsStateWithLifecycle()
    is not collecting when we use Navigation3 as the Composable is receiving only Lifecycle.state.CREATED not Lifecycle.State.STARTED. But the
    collect**cycle()
    needs STARTED state. If we manually change minActiveState = CREATED, Then its fine, But the default is not working....... Navigation3 Version: 1.0.0-alpha08 Lifecycle Navigation3: 2.10.0-alpha03 Runtime, UI, Viewmodel-nav3 libraries Also included ViewModelStoreNavEntryDecorator, SavedStateNavEntryDecorator... as recommended. If I fallback to the Navigation-Compose (Legacy), It is working fine......
    i
    t
    g
    • 4
    • 8
  • s

    Shahid Iqbal4213

    09/08/2025, 4:03 PM
    Hey guys I'm facing a strange issue with cmp could not build the objective-c module 'composeapp' When running cmp project.
  • e

    Eslam Hussein

    09/10/2025, 8:38 AM
    Hi 👋 , I’ve been running into this situation and wanted to get your thoughts. On bigger/complex screens, I often deal with multiple API calls and lists. Sometimes I reuse the same UI component (or “sub-screen”) across different parent screens. That component often needs the same data. For example, imagine we have a post list, and each post has comments. This list is used in multiple screens (say, 3 screens), and within this list, there are 7 API calls that need to be handled in the ViewModel. My preference is to keep a 1:1 relationship between a screen and its ViewModel. For these reusable components, I’m thinking about splitting the list and its API handling into a sub-ViewModel or sub-screen, so it’s easier to reuse. I’m not sure if this is a good approach in Jetpack Compose or not. Do you think this is still a good approach for reusability, or is there a better pattern to avoid duplicating ViewModels across screens?
    j
    • 2
    • 1
  • t

    Tlaster

    09/11/2025, 10:29 AM
    I'm getting
    Fatal Exception: java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
    when I selecting a text in SelectionContainer -> keep selecting and navigate back. Full stacktrace in thread.
    z
    • 2
    • 4
  • s

    Sergio Moral

    09/11/2025, 2:09 PM
    Hi everyone! Has anyone face a problem with zoom gestures about performance? I have created a simple Box with an image and some button above the image and it seems that in release mode it works bad. Sometime you make a gesture and must wait 1 second the get the gesture executed. I have checked recompositions but no unnecessary recompositions made and it works better in debug mode than in release mode 🤯
    s
    • 2
    • 1
  • c

    Colton Idle

    09/11/2025, 3:59 PM
    I'm running an android 16 QPR release and I'm getting a warning when running my compose app that
    /lib/arm64-v8a/libandroidx.graphics.path.so
    isn't 16 KB page size compatible. Anyone know if this is a known compose issue? I'm not really doing anything too crazy in my app in terms of dependencies so I'm kinda lost at this androidx.graphics warning.
    s
    • 2
    • 16
  • i

    Irsath Kareem

    09/13/2025, 3:01 PM
    Any help? If
    ModalBottomSheet
    is in the composition tree in a specific screen, Overlaided (Behind Sheet) Composables not receiving any pointerInputs (Gestures). - (
    shouldDismissOnClickOutside = false
    ) I need a Behaviour such that, While
    ModalBottomSheet
    is open, I want to interact with other composables behind the Sheet, Is it possible? I see the implementation of ModalBottomSheet, as it is taking control of entire window. Any workaround on this?
    j
    • 2
    • 6
  • c

    Colton Idle

    09/15/2025, 4:31 PM
    Reviewing some code today where a BorderStroke was set to 1.66dp Having a
    dp
    set to a
    .66
    value seems really weird. Is there any sort of documentation i can point to for this instead of just having a feeling that this is wrong? looks like we just copied the exact val from sketch.
    k
    c
    +2
    • 5
    • 11