14,334 questions
-1
votes
1
answer
57
views
How to avoid duplicating state between parent and child screens when passing parameters built by childs?
In Jetpack Compose with MVVM, I have a parent screen that contains 3 child screens. Navigation is used to move between the child screens.
Each child screen can generate a PDF in different ways:
One ...
0
votes
0
answers
51
views
Android Hybird Fragment Compose layout, extra padding added after software keyboard shown
I have a hybird fragment, compose layout. After I tap on a text input, some extra padding is added under the app bar
My layout looks like this
<?xml version="1.0" encoding="utf-8&...
Best practices
0
votes
2
replies
54
views
Should a ViewModel live as long as the entire app? ViewModel inside Scaffold with BottomSheet + Google Maps
I am building a Jetpack Compose app that uses a Scaffold with a persistent bottom sheet.
The main content of the Scaffold show Google Maps, and the bottom sheet shows a menu.
I have a MapViewModel ...
2
votes
1
answer
59
views
How to handle errors in compose viewmodels?
Imagine something like this:
class FileModel: ViewModel() {
private val _state: MutableStateFlow<FileState> = MutableStateFlow(initialState)
val state: StateFlow<FileState> = ...
-4
votes
0
answers
37
views
Jetpack Compose [closed]
How can I implement the following behavior using Jetpack Compose? I have cards with multiple images (one or more). I want to implement a behavior where clicking on an image causes the image to animate ...
-2
votes
1
answer
75
views
How i disable bounce effect if button is not enabled? [closed]
I have disabled ripple effect in my entire project using CompositionLocalProvider.
@Composable
fun SpotifyTheme(
content: @Composable () -> Unit,
) {
val colorScheme = colorScheme
...
0
votes
1
answer
73
views
How to access AnimatedContentScope in navigation 3 in compose navigation?
Jetpack navigation 3 is now stable, and I am learning how to work with this type of navigation. One thing I'm missing is the AnimatedContentScope of shared elements using navigation. In navigation 2, ...
0
votes
1
answer
59
views
Latest version of Compose Maps dependency throws "IllegalArgumentException: source must not be null"
When using com.google.maps.android:maps-compose in version 6.12.2 I get the following error building the project:
org.jetbrains.kotlin.util.FileAnalysisException: While analysing <redacted>/...
-1
votes
0
answers
67
views
How can I resolve "None of the following candidates is applicable" when I want to add an image in Jetpack Compose? [closed]
I was learning and practicing how to use Jetpack Compose by doing a Columns exercise adding items. I started with Text() which allowed to add text and modify it at will.
The problem is when I set ...
Advice
0
votes
1
replies
26
views
Android Jetpack Compose UI testing: equivalent of espresso clearFocus()?
It is common to test inline errors by filling out a textfield and then clearing focus, as the validation happens after the user is done with it. In espresso that can look like:
onView(allOf(...
Advice
0
votes
2
replies
49
views
how can I improve seat rendering in compose when the layout is separated by section, row, and column
I confused why my apps is lagging when I scroll down to this seat layout, what's wrong with my code? Can somebody tell me how can I improve the performance. Here is my code that I used for to create ...
-3
votes
0
answers
49
views
Get current location (longitude, latitude) once directly without using Google APIs? [duplicate]
I'm using Kotlin and Compose, and I can't figure how to get the current location once via only GPS. I don't want to use Fused Location Provider. The location doesn't have to be precise and it's not ...
Advice
0
votes
2
replies
58
views
How to lock orientation in the age of adaptive layouts?
I sat down for the first time in a while to work on a personal project - a simple edge-to-edge 'touch to draw' app. I planned to lock the orientation to landscape only to prevent refreshes on rotation....
0
votes
0
answers
49
views
How to keep a specific LazyColumn item visible when the keyboard opens?
I have a bottom sheet used for search, and it has two UI states. Both states share the same LazyColumn.
State 1:
LazyColumn {
item { Row { ... } } // search categories
item { Text(text = &...
-2
votes
1
answer
115
views
LinearProgressIndicator displays wrong progress when its size is modified
I'm having trouble with the progress indication of the LinearProgressIndicator when its height is increased:
The progress is very small (1%), but the second LinearProgressIndicator shows a much ...
0
votes
2
answers
67
views
How to load SVG content images(not url) using Coil on Android
For example, the SVG content obtained from the web is:
<svg t="1717950268208" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3....
0
votes
0
answers
72
views
How to hide or change navigation bar overlay color when opening bottom sheet?
im using modal bottom sheet in jetpack compose, even though im setting navigation bar color to transparent, when bottom sheet comes up, the black overlay is comes up on navigation bar, how can i hide ...
-1
votes
0
answers
43
views
Android Studio, Kotlin, Jetpack Compose, displaying the card when the checkbox is checked
I have a problem with displaying the card when the checkbox is checked. I would like a given card in one activity to be displayed only when the user selects a given checkbox in another activity. But ...
0
votes
2
answers
96
views
Make a Button always visible at the bottom of a Jetpack Compose ModalBottomSheet
I am trying to implement a ModalBottomSheet in Jetpack Compose - Android where a "Click to Hide" button is always visible at the bottom of the sheet. This button should remain visible and ...
Advice
0
votes
1
replies
88
views
Jetpack Compose: Investigate UI crash with unknown origin (Fatal Exception: java.lang.IllegalStateException: Required value was null.)
I see that users are getting the following error in my app. The problem is that the stacktrace doesn't lead to the point of origin in my app. Although I highly suspect it is a certain custom text ...
0
votes
0
answers
38
views
Android compose deeplink navigate with initial PIN validation
Is my solution correct? What solutions do you recommend?
I use compose type safe navigation. I've created helper viewModel for navHost to store isValidated flag and for passing complex models from ...
0
votes
0
answers
33
views
Zombie deeplink Intent reopens from systems overview
Steps to reproduce:
notification --[intent]--> ...Annoucement Details with Pin Validation --[back]--> home screen
--[SYSTEM nav bar back]--> exit app --[system bar overview reopen]--> {!!!...
1
vote
1
answer
154
views
How to make compose Image only be clickable on the image and not on the transparent background
I am using compose Image as buttons, the images that I am displaying are all different kinds of shapes, and I am using .combinedClickable() on them like this:
Image(
bitmap ...
2
votes
2
answers
109
views
Only first DAO Flow of Room database returns values
I want to retrieve a specific column from my Android ROOM Database but it kept returning an empty list.
Here is the code on my DAO interface:
@Query("SELECT * FROM expense_table ORDER BY category ...
1
vote
1
answer
74
views
why my navbar animation is not smooth at the start of application
I just created some animation on my navbar. When i try to run it, i just wonder why the animation feels laggy at the start of application. And after some seconds, the animation start to feels smooth, ...
2
votes
1
answer
113
views
Glowing Effect from Image Colors in Jetpack Compose
I have a question: is it possible in Jetpack Compose to create a glowing effect similar to what YouTube uses when playing a video? I mean a dynamic effect based on the image colors. If not, how can I ...
2
votes
2
answers
309
views
How to use NavigationBackHandler?
I currently have the following code in my Compose Multiplatform project:
var myStateVariable by rememberSaveable { mutableStateOf(false) }
BackHandler(myStateVariable) {
myStateVariable = false
}
...
0
votes
0
answers
32
views
Jetpack Compose (KMP) WindowInsets.navigationBars returns 0.dp on first composition and updates later — why does padding recompute twice?
I’m building a Kotlin Multiplatform (KMP) project using Compose Multiplatform for Android and iOS. On Android, I’m trying to calculate bottom padding for a bottom sheet using WindowInsets....
1
vote
1
answer
61
views
How to Fix Incomplete Web Styling in Compose WebView?
I'm developing an Android app with Jetpack Compose and planning to implement a built-in web browsing feature. Below is my basic code. I've found that my code works normally (both in styling and layout)...
4
votes
2
answers
152
views
How to call a composable function after a certain time in Jetpack Compose?
When my application starts, I launch an animation. Now I would like to switch to another component (navbar) after 30 seconds. In my research, I saw that the delay function from the Kotlin Coroutines ...
2
votes
2
answers
129
views
How can I return a result from a Room database in a thread-safe way?
I want to implement a query that returns a result. Android requires that this type of query occurs on a separate thread to avoid locking up the UI thread.
My code is based on the tutorial https://iifx....
0
votes
0
answers
119
views
How do I implement custom scene navigation animations in Compose Navigation 3?
I'm using the TwoPaneSceneStrategy as available on Google's Nav3 Recipes repo to display the content in a NavDisplay. This is the Scene that actually displays the content:
class TwoPaneScene<T : ...
1
vote
1
answer
79
views
Koltin Compose with MVI results in heavy boiler plate code, how to reduce it?
Compose has great advantages but I feel the readability and code complexity increases when the fields increase.
Here is an example:
data class UserForm(
val firstName: String,
val lastName: ...
-1
votes
0
answers
88
views
Android Compose: Balloon content width and arrow positioning issues in skydoves/Balloon library
Problem Description
I'm using the com.skydoves.balloon.compose library in my Android Compose project to display tooltip views. I'm facing two issues:
Width Issue: The content inside balloonContent is ...
3
votes
1
answer
147
views
Jetpack Compose navigate failed when start an activity from a notification
My app has a modal navigation drawer to navigate between home page and target page.
I tried to launch the app and navigate to the target page by tapping a notification containing a deeplink intent, ...
-1
votes
1
answer
87
views
Writing a compose test with a ViewModel in a dependency
I'm trying to write a roboelectric compose test with code that looks like this:
@Composable
fun MyParentLayout() {
val viewModel = hiltViewModel<MyParentViewModel>()
MyParentImpl(viewModel....
4
votes
1
answer
71
views
How to disable Jetpack Compose preview functions for code search in Android Studio
I’m using Android Studio with Jetpack Compose, and I often use the “Find in Files” feature (Cmd + Shift + F / Ctrl + Shift + F / clicking in a function/class to see the usages) to search for code ...
7
votes
1
answer
144
views
Synchronization Issue Between ModalBottomSheet and Keyboard Animation in Jetpack Compose
I’m encountering a problem with the synchronization of the ModalBottomSheet animation and the software keyboard (IME) animation in Jetpack Compose, and I would appreciate any insights or suggestions.
...
2
votes
1
answer
82
views
New list in Compose doesn't refresh the UI
I'm working with Compose and the ViewModel and a list. I don't understand why my UI isn't recomposing when I click on the button, although I am generating a new list.
data class Dice(var value: Int = ...
1
vote
0
answers
66
views
Jetpack compose Canvas perspective model
If I have a simple drawing like:
Box(
modifier = Modifier
.size(coinRadius * 2)
.graphicsLayer {
cameraDistance = 12f * density
rotationY = rotation.value
}
.clip(...
0
votes
0
answers
67
views
Virtual Phone in Android Studio in loop showing Starting Up…
At the moment, I am trying to get a virtual phone (Pixel 7) running in Android Studio. I already tried the following things, to optimize/ enable the bootup:
deactivated VBS
activated ...
0
votes
0
answers
43
views
Shared element keeps going back to the top left grid square when using a container transform with shared element transitions
I'm working on a trivia game and I want the grid squares to go larger to show the full trivia question and buttons. I'm using a container transform and that works just fine except for one thing. All ...
0
votes
0
answers
33
views
Why is a dropdownmenu bigger than its content? [duplicate]
Why is the DropdownMenu Container bigger then its child? Is there a minimum size or padding that we don't have control over? Or is it a theming problem? I dont want it to be this big. I want the ...
3
votes
1
answer
142
views
How to distinguish between 1-finger and two-fingers pointer input
I'm writing a mobile app in Jetpack Compose that is supposed to detect both the transform- and drag gestures. However, they interfere with each other. I tried nesting the detectDragGestures() and ...
1
vote
0
answers
51
views
DialogFragment z-order reversed after app backgrounding with Compose Navigation
Problem
I'm using Jetpack Compose Navigation with dialog destinations. When I show a DialogFragment on top of a Compose Navigation Dialog, the order is correct. But after backgrounding the app and ...
0
votes
1
answer
75
views
TextFields Disappear After App Resume from Background Until Keyboard Opens [closed]
I have a screen in my Android app using Jetpack Compose. The issue is:
User fills in the text fields and leaves the app (app goes to background)
When user returns to the app, all TextFields completely ...
0
votes
1
answer
85
views
Should I always initialize a viewmodel at the start? [closed]
Should I always initialize a viewmodel in the Activity, before onCreate() even, if it is needed later in the flow?
I do not know and am concerned if initialization of all the viewmodels right at the ...
0
votes
2
answers
100
views
AnimatedContent, is the targetState parameter always necessary?
Inside a composable I have a call to another composable to display the actual content area:
Content(dat = dat, uiState = uiState, onUiEvent = onUiEvent)
On the even that uiState.singleId changes the &...
3
votes
1
answer
117
views
How to scroll to the last entry in a LazyColumn so it is displayed at the top and not at the bottom?
I'm building a chat interface in Jetpack Compose using a LazyColumn.
When a user sends a new message I want their latest message to appear at the top, and older messages should scroll up automatically....
0
votes
1
answer
89
views
Have you used immutableList in Android Compose? [closed]
Have you used immutableList from kotlinx.collections.immutable. And did you see the performance changes in your project ? Thank you in advance for sharing your experiences