14,269 questions
Best practices
0
votes
0
replies
20
views
Wear OS DataLayer Observer in MainActivity with ViewmodelProvider and Room DB
I have been following the pattern in the tutorial (https://developer.android.com/courses/pathways/android-basics-compose-unit-6-pathway-2) to integrate a Room database into my app. So I have a ...
0
votes
0
answers
31
views
Low-frequency sound sometimes occurs in the Android emulator when recording audio with MediaRecorder
I'm learning to build a simple audio recorder app in Jetpack Compose using the native MediaRecorder. When testing it in the Android emulator, it sometimes produces a low-frequency sound throughout the ...
1
vote
2
answers
95
views
Request focus on TextField without opening keyboard
I want the text field on my chat screen to be focused by default (the cursor should be visible) when the user opens the screen. However, I do not want the keyboard to open automatically. The keyboard ...
Best practices
0
votes
0
replies
34
views
AndroidTV - FocusRestorer does not focus fallback if currently focused node is removed
I am currently developing a video streaming app for AndroidTV. To reduce the amount of data the client loads, it's a business requirement that we are able to lazy-load Swimlanes (LazyRows) once they ...
1
vote
1
answer
90
views
animateItem() in LazyList shadow clip / flickering problem
I'm currently experiencing an issue with cards in my lazy list in the app I'm developing:
when the lazy list reloads the items (because I trigger some MutableStateFlow change and so the items in my ...
0
votes
0
answers
60
views
Weird excessive amounts of LogCat for frame rate appearing on Android 15/16 when running animations
Im seeing a lot of the following in the LogCat for any App i'm running that has some sort of animation on it.
setRequestedFrameRate frameRate=NaN, this=android.view.View
setRequestedFrameRate ...
Best practices
0
votes
3
replies
96
views
Android - How to create a responsive scrollable Column inside another Column without fixed height?
I’m trying to build a layout in Jetpack Compose where I have a Column nested inside another Column, and I want the inner one to be scrollable.
The key requirement is that the scrollable container ...
2
votes
0
answers
65
views
Reconciling the software drawable boundary with the physical screen boundry on Android devices
Is there a device-agnostic way to draw a 1 px path that follows the physical rounded edge of an Android display?
As part of a larger problem, I'm trying to draw a 1 px line that hugs the physical ...
3
votes
0
answers
105
views
TextAlign.Justify only works on the emulator, not on a physical device
why are all the lines (not just the last line of the paragraph) aligned to the left on a real device, while on a virtual device they are aligned to the width of the screen except for the last one (as ...
0
votes
1
answer
90
views
Jetpack Compose chat input: extra space above keyboard and TextField height changes when text starts with spaces
I’m building a chat screen in Jetpack Compose similar to WhatsApp, with a LazyColumn for messages and a message input field anchored at the bottom.
I’m facing two related issues with the message input:...
1
vote
1
answer
175
views
ComposePausableCompositionException and IllegalStateException: Apply is called on deactivated node when fast scrolling LazyColumn with Coil AsyncImage
Hello everyone,
I am experiencing a persistent crash in my Jetpack Compose project while using Coil (AsyncImage) inside a LazyColumn. The data is being observed from a remote service via Flow.
The ...
2
votes
1
answer
149
views
Android compose material3 dropdown menu bug on landscape?
Is this behaviour a bug with the experimental material3 features on Android 16?
When the app is portrait mode everything works correctly on Android 15 and 16.
When the app is in landscape mode Android ...
Advice
0
votes
0
replies
56
views
How to port the interfaces from Android's view. java to the jet-compose system
I already know that you can use AndroidView in compose to achieve this goal, but what I'm thinking is how to wrap the interface so that the calling object of the interface is composable. Like this:
...
0
votes
0
answers
34
views
IntelliJ's composable preview engine is stuck after an error
I've got a Windows Desktop Application in Jetpack Compose and sometimes when I manage to break my code and refresh the preview, the preview engine immediately shows an error, as it should. However, ...
Tooling
0
votes
2
replies
89
views
How to use attachAccessibilityOverlayToWindow() from android accessibility service
Currently, i am using windowManager.addView() to add accessibility overlay to display. How do i use attachAccessibilityOverlayToWindow(int accessibilityWindowId, android.view.SurfaceControl sc) to add ...
1
vote
1
answer
122
views
Jetpack Compose:DropdownMenu ignores anchor and shows at bottom of screen in Compose Dialog
I am trying to implement a custom Jetpack Compose Dialog that contains two elements with their own anchored DropdownMenu:
A Header Row with a downward icon that should trigger a menu when clicked.
...
Advice
0
votes
1
replies
100
views
How can I improve unit tests for Repository pattern with Room and Retrofit in Android?
I am writing unit tests for my Android MVVM app.
The repository fetches users from an API and stores them in a Room database.
If the API fails, it loads cached users from the database.
I wrote the ...
Best practices
0
votes
0
replies
83
views
Shall type-conversion be the responsibility of a function/method?
I got the following Android UI-code:
OutlinedTextField(value = mainVM.srcAmount.doubleValue.toString(),
onValueChange = { // Implicit generated argument 'it' is a String.
mainVM.setAmount(...
0
votes
2
answers
92
views
Gradiant 1 pixel lign misscolor Jetpack Compose
My initial goal was to use gradiant to transition smoothly my picture into the background.
Using gradiant, I have a one pixel lign that breaks the natural transition to the rest of the card.
The line ...
Advice
0
votes
0
replies
46
views
How can I recreate this Telegram channel element?
This is the element I'm trying to recreate
There's it's wider version
As far as I get it, this element consists of something like:
Column {
FlowRow{Chat1, Chat2, Chat3}
...
0
votes
1
answer
74
views
Set an optional argument of IntType in a Route for Androidx Navigation
I'm using Androidx Navigation as a router in my app, whereas I have a bunch of different routes, and one has some arguments of the shape: route?$sectionArg={$sectionArg}&itemId={$itemId}. For ...
3
votes
1
answer
113
views
Performance Issue: 2x2, 3x3 Grid Video Playback Lag on Android TV
I am currently facing a performance issue while testing my Android TV application.
When I configure a 2x2 grid layout and play local videos (approximately 1 GB each) from the device storage, the ...
Advice
0
votes
1
replies
93
views
How to integrate native SwiftUI views into Compose Multiplatform using UIKitView?
I am building a Compose Multiplatform (CMP) application and need to leverage some iOS-specific native components (like MapKit or a custom SwiftUI chart) that are already built in SwiftUI.
While CMP ...
4
votes
1
answer
113
views
Right align texts in Canvas using Jetpack Compose
I want to draw a chart but I'm not able to right-align the Y axis labels:
@Composable
fun Chart(
min: Double = 0.0,
max: Double = 3823.0,
) {
val textMeasurer = rememberTextMeasurer()
...
3
votes
1
answer
119
views
How to prevent the virtual keyboard from getting stuck to the text field in Jetpack Compose?
When I click on a text field, the keyboard appears. The problem is that it sticks directly to the text field, with no visible space between the two. I am using Jetpack Compose and would like there to ...
-1
votes
1
answer
53
views
Sharing common State logic between different MVI Intent handlers
While developing my Android app with the MVI architecture, I encountered a problem. I have screens that consistently use the same intents. For example, the UserScreen and Search Screen have their own ...
0
votes
0
answers
59
views
How to change the ModalNavigationDrawer in Android TV using Jetpack Compose?
i have build a Android TV app using jetpack Compose, now i have some problem with the ModalNavigationDrawer my own is to wide when the drawer is expand this my code
class TVHomeActivity : ...
1
vote
1
answer
126
views
Error using Material 3 TextField: "None of the following candidates is applicable"
I am making a small program to control some remote devices and I want to take data from a time picker and show it in a text field.
However, Android Studio marks my TextField with this error:
None of ...
1
vote
1
answer
117
views
Exoplayer related Composable makes an app not responsive
I have a custom PlayerComponent based ExoPlayer. It makes the whole application not responsive when it is playing. I thought that the issue is about too frequent position state updates, but when I ...
0
votes
0
answers
50
views
How to change the TimeInput text field border color
I’m using the Material 3 TimeInput Xomposable in Jetpack Compose.
TimeInput(
state = state,
colors = TimePickerDefaults.colors(
selectorColor = OrlenTheme.colors....
0
votes
0
answers
90
views
Issues with font weight settings in Jetpack Compose when drawing text on Canvas
I am having some issues with the font weight settings in a Kotlin/Jetpack Compose setup.
In my app (simple photo editing), I want to be able to add a text to an image.
To position the text, I use a ...
0
votes
1
answer
118
views
Jetpack Compose: Bottom button moves up with keyboard, want it scrollable instead of resized
I am building a screen using Jetpack Compose with Scaffold, Surface, and ConstraintLayout.
The screen has a BasicTextField in the center and a Continue button fixed at the bottom.
When I tap on the ...
-2
votes
1
answer
93
views
ViewModel onCleared() is not called when I close the app [closed]
I am using Jetpack Compose with navigation graph and dagger hilt. Let's say I have two screens: home screen and settings screens. I open the app, I go to home > settings. If I close the app (...
1
vote
0
answers
96
views
How to avoid backround leaking as an outline around swipable card in Jetpack Compose
I am trying to implement a custom swipe-to-delete card in Jetpack Compose without using any library.
Inside a parent Box, I have two composables layered on top of each other:
The bottom one is a red ...
0
votes
0
answers
82
views
Kotlin Jetpack Compose LazyColumn + stickyHeader: focused item hidden under sticky header when navigating with keyboard or with accessibility TalkBack
I have a LazyColumn with multiple stickyHeaders. When navigating the list using keyboard, I encounter a layout issue.
Expected behavior
When an item receives focus, the list should scroll so that the ...
0
votes
0
answers
62
views
android compose mqtt implementation
i'm actually creating an app to control a raspberry pi robot, but for the communication i must use the mqtt protocol, i'm using the davidepianca98 library for that but i don't know where to put the ...
Best practices
0
votes
0
replies
21
views
Android compose scalability multiple switches in a view
I've been working on an android app that needs to handle multiple switches inside one single screen. Basically my question is about scalability and recomposition counts. I leave the code here:
Current ...
1
vote
0
answers
42
views
Is there a way to avoid duplicating productFlavors and buildConfigField across multiple Android modules?
I have a multi-module Android project with modules like:
app (application module)
data (Android library module)
domain (pure Kotlin module)
I’m using product flavors (dev, staging, prod) to define ...
1
vote
2
answers
160
views
Unresolved reference 'AnchoredDraggableDefaults when generating Release Build
I am using anchoredDraggable in my project to implement Swipe Control in Compose. I am using Compose BOM 2024.09.00 in my project.
When I start a debug build, the project builds well and launches the ...
1
vote
1
answer
72
views
Android Play Asset Delivery (install-time) issues in native Kotlin Jetpack Compose app
Can somoene please explain to me, how to properly setup Play Asset Delivery for my android jetpack compose kotlin native app?
I have tried many setups, and tested many things. Here is my current setup:...
0
votes
0
answers
65
views
how to align Text and IconButton composables in a grid
Using Jetpack Compose on Android, I am trying to layout a lot of IconButton in a grid with Text headers on the columns and rows. I'm using Modifier.weight. As you can see from this example, Text and ...
2
votes
1
answer
130
views
Swipe moves to the last anchor even when finger not released from swipe control while dragging
I am trying to implement swipe control in my app, using the Compose BOM 2024.09.00.
Currently when swiping right, as soon as the threshold is reached - i.e. half of the swiping is done - the swipe ...
3
votes
1
answer
165
views
Accessing a lambda's parameter leads to "Assignment type mismatch: actual type is 'Unit', but 'String' was expected"
I'm trying to pass a click handler to a child function that sends a string back to the parent and updates a mutable value based on the string. I'm getting an error on the function:
Assignment type ...
2
votes
1
answer
126
views
I can't launch the app because of the TextField element [closed]
I'm trying to work in practice with the TextField markup element, but at the moment I'm facing such a problem that when using the onValueChange parameter, I get an error. Here is the full function ...
1
vote
0
answers
69
views
Screen transition effect, which shows underlying screen
I am trying to replicate a screen transition effect in Compose, similar to the one used in Poweramp's UI (swiping from the edge to reveal the previous screen which simultaneously scales in the ...
4
votes
1
answer
234
views
AdMob App Open Ad: Close button stuck in loading state/spinner and cannot be dismissed
I am experiencing a critical issue with AdMob App Open Ads where the ad displays, but the user cannot dismiss it. Instead of the "Close" or "X" button appearing after the ...
Advice
0
votes
1
replies
105
views
How to create similar comments section found in youtube, reddit etc in jetpack compose?
I am trying to create the visual and functional comment section in jetpack compose similar to youtube or reddit, see the images below. I have tried a few approaches but cant really replicate the way ...
0
votes
0
answers
108
views
Compose crashes with "class [...] cannot be cast to class [...]" when switching between two types that inherit from the same class
This bug requires some setup but I tried to reduce it as much as possible.
The app
I'm working on a compose desktop app that has different "modes". Each mode has its own UI and business ...
4
votes
0
answers
120
views
How to announce page context ("Page X of Y") in HorizontalPager in Jetpack Compose with a11y?
I am building a custom selector component in Jetpack Compose. It consists of a HorizontalPager where each page contains a LazyVerticalGrid of selectable items (acting like Radio Buttons).
The problem: ...
0
votes
0
answers
235
views
Room 2.8.4 KSP error: Cannot find required type element LimitOffsetPagingSource
I'm experiencing an error while compiling my Android project after switching a DAO return type from List to PagingSource.
The DAO query looks like this:
@Query("SELECT * FROM track_table WHERE ...