https://kotlinlang.org logo
Join Slack
Powered by
# compose-android
  • 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
    • 16
  • 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
  • a

    Adrian Landborn

    09/18/2025, 9:45 AM
    I am using Material3 `SearchBar`component together with the
    SearchBarDefaults.InputField
    inputfield is there a way to control cursor position with this implementation? I feel it is a bit odd that they didnt add a `SearchBarDefaults.InputField`that uses
    TextFieldValue
    as query but only using a
    String
    . Any ideas how to handle that without re-implementing a the whole Inputfield?
    • 1
    • 1
  • b

    brandonmcansh

    09/23/2025, 4:31 PM
    Has anyone using Nav3 been able to setup nested navigation in a BottomSheetStrategy? Trying to support inner screens inside bottom sheets
    👀 1
  • b

    bj0

    09/29/2025, 7:06 PM
    Hey, I'm running into an issue with drawing text on a canvas. I'm drawing some chart-like graphics (rectangles, lines and text), and the size will scale with content. I am limiting the size of the canvas though to a specified max. My goal is to specify the
    .size()
    on the canvas and use clipping so that the drawing functions don't have to care about the size of the canvas, they just draw their full content as normal. This is working fine for shapes (rectangles, lines), but when I try to
    drawText
    , as soon as it gets too far outside the limits of the canvas size, it throws an
    IllegalArgumentException: maxWidth must be >= than minWidth, maxHeight must be >= 0
    . Im not sure why it does this, is there a workaround so that I can still avoid having a bunch of size checking logic in the drawing functions?
    r
    • 2
    • 40
  • m

    mattinger

    10/08/2025, 3:19 PM
    Hi all. I'm working in a composed based design system library. It gets published as an aar, and it has a reference app that we maintain so we can see a catalog of the components we're providing in the library. As such, it only really has a debug variant, and thus does not need any code signing. We will also typically take our @Preview functions and deploy them to the emulator. When we do that, we select the reference application as part of the run configuration. Sometime recently i've started getting this error when trying to do this in AS (narwhal 3 feature drop):
    Copy code
    Error: The apk for your currently selected variant cannot be signed. Please specify a signing configuration for this variant (debug).
    I've even tried adding a debug signing key by adding the keystore and doign this in the app module:
    Copy code
    signingConfigs {
            getByName("debug") {
                storeFile = rootProject.file("keystore/debug.keystore")
                storePassword = "xxxxx"
                keyAlias = "xxxxx"
                keyPassword = "xxxxx"
            }
        }
    
        buildTypes {
            getByName("debug") {
                signingConfig = signingConfigs.getByName("debug")
            }
        }
    But it still shows the same error. Does anyone have any idea how to resolve this and/or what changed recently to cause this?
  • t

    Tlaster

    10/09/2025, 3:45 AM
    After updated to navigation3 1.0.0-alpha11, using
    SceneStrategy<T>.then
    will cause infinite loop and the app will crash, seems like this line cause the issue.
    i
    b
    • 3
    • 5
  • b

    bryankeltonadams

    10/10/2025, 12:30 AM
    Would you want to use SceneStrategy with a per screen top app bar setup or would that not really work well? I was excited to try it after watching how easy it was to get a list detail view setup that way but not need to necessarily build it with a single Composable. But I always do TopBar per screen rather than a global one.
    s
    • 2
    • 2
  • e

    eygraber

    10/10/2025, 4:14 PM
    I'm using the latest stable Compose BOM together with nav3. If I update nav3 to 1.0.0-alpha11 I start getting NPE from
    LookaheadPassDelegate.forEachChildAlignmentLinesOwner
    (via material3
    Scaffold
    ). Is this because nav3 is pulling in some alpha Compose artifacts, but others are on stable?
    • 1
    • 2
  • p

    Poulastaa

    10/11/2025, 7:23 PM
    Hello everyone, Live-reload keep breaking even in simple changes. code is in thread. Any and all suggestion is helpful. Thank you for taking the time to help. Really grateful for that.
    • 1
    • 4