14,343 questions
3
votes
2
answers
694
views
How do I change color of Android system navigation bar API 35+
I am unable to change color of system navigation bar. In dark mode it ineed appears as transparent and its fine (ideally I would want it to be the same color as bottom navigation bar), but for light ...
0
votes
0
answers
47
views
Using Google Noto CJK Variable Font Collection in Android Apps
My final goal is to load fonts from a Variable Font Collection file. Most phones sold in China enable users to use custom fonts system-wide(ideally), but most of those fonts don't have full support ...
-3
votes
2
answers
126
views
Best practice in Compose to render lots of data using mutable states
My problem is, I have a lot of data and want to render it in Jetpack Compose in a table, being able to modify that data.
My situation
Let’s say I have a class called User, with the name and some ...
1
vote
1
answer
65
views
Images are not updated despite a changed MutableState
I'm using images (.png) to show the "X" and "O" in the game. But it appears that they don't show up until the game is over.
The game logic:
enum class Player {
X, O
}
enum ...
2
votes
2
answers
46
views
When multiple Composables share the same ViewModel, should MutableStateFlow updates be wrapped in viewModelScope?
I inject the same MyViewModel into multiple Compose screens and use MutableStateFlow to manage state.I want to confirm: when updating MutableStateFlow.value in the ViewModel, is it necessary to wrap ...
1
vote
1
answer
32
views
android.view.InflateException: Binary XML file line #29 in android:layout/screen_simple: Cannot add views to ComposeView
I am converting an app that is a few years old to Jetpack Compose. It's fragment based, and all of the fragments are migrated to Compose already, but I hit a problem converting the one and only ...
2
votes
1
answer
134
views
In Jetpack Compose, how can I prevent HorizontalPager from scrolling when swiping left or right on the edge of the screen?
I've created a HorizontalPager with a width that matches the screen. However, I've noticed that when I use the edge swipe gesture on the phone to go back to the previous screen, it momentarily causes ...
1
vote
2
answers
77
views
TextField with AnimatedVisibility should show keyboard (requestFocus)
I have a TextField that is displayed when the user clicks on the search button, and the visibility is animated. The problem is that when I request the focus to show the keyboard, the composition is ...
2
votes
1
answer
105
views
Clean way to share data between viewModels
I'm trying to follow Google's clean architecture guidelines.
I have a navigation subgraph with multiple pages corresponding to stages of filling a form.
Each page has it's own viewModel.
On the last ...
0
votes
1
answer
51
views
Why does Android ExoPlayer get started twice when my activity is re-launched after an in-app update?
When my Compose-based launch activity is run, it displays a video using ExoPlayer. This works fine, but when it happens after an in-app update the video starts playing briefly then restarts from the ...
1
vote
1
answer
123
views
When I set the card elevation, an invisible rectangle appears inside the Card composable
I'm learning to build an Android App using Jetpack Compose. In my UI, I have a custom card composable HomeScreenCards. When I apply elevation to the Card like this :
elevation = CardDefaults....
2
votes
3
answers
284
views
AnimatedContent size change animation not working smoothly in Jetpack Compose dialog
I'm trying to animate a size change inside a Dialog in Jetpack Compose using AnimatedContent. The goal is to smoothly transition between two different UI states that have different heights. However, ...
1
vote
1
answer
103
views
Can I get TalkBack to read Arabic text in my mostly English app when the device language is set to English?
I have a view in my app which needs to show a mix of English and Arabic, as follows:
The above view is a Column that contains two separate Text items.
My app is localised to English. It has the odd ...
0
votes
1
answer
98
views
How to avoid continuous SensorEventListener callbacks
Android beginner, please make no assumptions!
I created code that used a SensorEventListener to update a UI using a MutableDoubleState as an intermediary. This worked well with the event registration ...
0
votes
2
answers
87
views
NoSuchMethodException in NotificationSyncWorker with Hilt and WorkManager (Kotlin, Hilt 2.56.2, WorkManager 2.9.0)
I use Hilt with WorkManager to synchronize notifications in the background in my application, but I encounter a java.lang.NoSuchMethodException error when trying to create an instance of ...
1
vote
2
answers
148
views
How do I get the size and position of an indirect descendant in Jetpack Compose?
I need to know the size and position of the indirect child of my component in order to place the other child.
Here's a simple example of what I mean.
Column {
Box {
Text()
}
...
1
vote
3
answers
79
views
How to make an element block click actions instead of passing them to the parent element?
In Jetpack Compose, let's say I have a Layout with a big blue box and a smaller red box inside it:
Box(
contentAlignment = Alignment.Center,
modifier = Modifier
.background(Color.Blue)
...
0
votes
1
answer
66
views
Jetpack Compose/Glance: previewLayout value
An <appwidget-provider> expects a previewLayout attribute on modern Android versions. The documentation tells us what value we should use for initialLayout, but it never mentions the ...
2
votes
3
answers
129
views
Easy way to trigger a recompose without using MutableState
In Jetpack Compose, I was looking for an easy way to trigger a Composable element to recompose (meaning to update / reload).
This can be useful e.g. for when you don't want to use MutableState. I had ...
3
votes
2
answers
987
views
How to resolve deprecated ClipboardManager in Jetpack Compose?
The ClipboardManager interface was deprecated. What should I change?
0
votes
0
answers
105
views
How can i run a custom chrome tab inside my app's window in recents?
i have this setup
LaunchedEffect(authUrl) {
authUrl?.let { url ->
val customTabsIntent = CustomTabsIntent.Builder()
.setDownloadButtonEnabled(false)
....
-4
votes
1
answer
113
views
How to fix "Content padding parameter it is not used" when using Scaffold? [duplicate]
Today I tried to learn Jetpack Compose. But I immediately ran into a problem: scaffold is underlined in red for some reason, but everything works. I kind of added the library. Maybe I'm doing ...
0
votes
3
answers
103
views
When should I make an API call while navigating from one screen to another in Jetpack Compose (ViewModel per screen)?
I'm working on a Jetpack Compose Android app that displays a list of trains.
I have Screen A that shows a list of trains and Screen B that displays the details of a selected train.
Each screen has its ...
0
votes
2
answers
139
views
Remember scroll position when navigating screens of the app
I'm trying that the Android app remembers in which position of the screen the user left it off, so they can carry on when they move back and forth in the app.
I'm looking for the simplest way (ideally,...
0
votes
1
answer
46
views
setting minZoomPreference or maxZoomPreference on Compose GoogleMap doesn't work
I've a simple GoogleMap in Compose:
GoogleMap(
modifier = Modifier.fillMaxSize(),
cameraPositionState = cameraPositionState,
uiSettings = MapUiSettings(
...