Questions tagged [android-jetpack-compose]
Jetpack Compose is Android’s modern toolkit for building native declarative UI made by Google. If you're targeting desktop with Compose for Desktop, use both this and [compose-desktop] tags.
10,386
questions
0
votes
0
answers
18
views
Is it possible to create a "tri-state" bottom sheet in Jetpack Compose?
I've tried looking around everywhere through documentation, videos, and Stack Overflow questions but haven't found exactly what I'm looking for.
What I'm wanting is a Modal style bottom sheet that ...
0
votes
0
answers
12
views
Jetpack Compose App crashed when updated from previous version
My app crashes when updated from previous version with Exception:
java.lang.IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG
It runs fine when new ...
0
votes
0
answers
10
views
How to travel to a non bottom bar screen with a single navhost?
I have a project where their are 4 screens in total. Home, Setting, rewards and connect. The bottom bar will contain 3 screens Home, Connect and Reward. However on the Home screen you can travel to ...
0
votes
1
answer
14
views
I would expect the Image to be recomposed here
Why is the Image not being recomposed here after the boxHeight gets a new value?
Should I trigger recomposition somehow?
(asking after a long day of trying to get the Image to have the same height as ...
0
votes
0
answers
12
views
upsert query is not working in room database for returned data from api
@ExperimentalPagingApi
class AnimeRemoteMediator @Inject constructor(
val AnimeDb: AnimeDatabase,
val jikanApi: jikanApi
):RemoteMediator<Int,AnimeEntity>() {
override suspend fun ...
0
votes
1
answer
34
views
How to apply splash screen with jetpack compose
How to make proper splashscreen in jetpack compose?
It kind of works, but first it goes to OnBoardingScreen then it load data from ViewModel I have the same viewmodel for these screens and reload to ...
0
votes
0
answers
19
views
Launch composable recomposition from non-composable context
@Composable invocations can only happen from the context of a
@Composable function
I need to recompose my @Composable method from outside. Currently I found only the ad-hock way to change the state ...
0
votes
1
answer
15
views
How to add a drawable resourse in jetpack compose in Icon()
I cannot add the R.drawable.image.png directrly to Icon()
still no answer Maybe someone can help.
As a result i might need to add i begger librarry for 200 mb - by i do not want to do it)
I want it ...
0
votes
1
answer
18
views
List of AutoCompleteTextField not visible (is drawing behind softKeyboard)
I have a problem, which I cannot solve ...
I have a activity where the user could add some information like name and so one. It is written in Kotlin with the Jetpack Compose library. One field is an ...
0
votes
0
answers
8
views
real time data plotting line graph with zoom effect in native android
I have a graph with real time data, the issue with that is it is not plotting in equal interval and on zoom it is starching the canvas instead of changing the interval .
Kindly help me by suggesting ...
0
votes
0
answers
9
views
Compose setShadowLayer alternative below API 29
So actually I have a modifier extension function to show a shadow in a composable. I'm using the code that created in this answer .
This is the code:
fun Modifier.advancedShadow(
color: Color = ...
1
vote
1
answer
25
views
Jetpack compose Implementing unidirectional flow Datastore -> ViewModel -> UI
I am working on my first app. I use android jetpack compose and Kotlin.
I am trying to persist some user preferences using datastore.
All the resources I find regarding the use of datastore somehow ...
0
votes
0
answers
25
views
Massive spike in "Excessive slow frames" from Android 12
Android Vitals is reporting a high rate of "Excessive slow frames" in Android 12 and 13. The same version has been running for 3 months+... Is there any known issue or something that I ...
0
votes
1
answer
17
views
Jetpack Compose Pager change currentPage
Is there a manual way or an appropriate way to change the current page for a Pager?
I may be breaking some written rules, but essentially I am updating the content of pages, but not changing the ...
0
votes
0
answers
24
views
Why does LaunchedEffect work but not collectAsFlowWithLifecycle()?
I want to update some text in a @Composable in response to events. I found an example of how to emit the event data as a flow using channelFlow and when I went to use that in my composable, ...
0
votes
1
answer
51
views
Jetpack Compose: Screen freezes when dissmiss ModalBottomSheet by swiping down by touching drag handle
I'm trying to create a ModalBottomSheet that will be visible and invisible depending on the value of a boolean state showBottomSheet. if showBottomSheet value is true, ModalBottomSheet will be ...
0
votes
0
answers
15
views
Why my tablayout row content doesnt fit the screen in jetpack compose?
I created a TabLayout on one screen in Jetpack compose and created two pages.I created a TabLayout on one screen in Jetpack compose and created two pages, but there is a problem: even if the content ...
0
votes
0
answers
19
views
what is the raw video URI in another module while using ExoPlayer
i am trying to set URI inside a different module for ExoPlayer in a moduler application. I am using following method to set raw video in a module. so the mp4 video is in the raw folder of a module.
...
0
votes
1
answer
36
views
MutableStateOf is not being re-initialized in Jetpack Compose
Below is a simple composable function, when I log the pd object it prints the current value of the retained(boolean) field. But after initializing the isChecked variable the value is always !pd....
0
votes
0
answers
39
views
Internal Testing of Wear OS android app app link not functioning
I uploaded a wear os app to play console and created internal testing track. After adding myself as a tester and accpeting the test invitation via the link provided, I attempted to download the app ...
0
votes
1
answer
19
views
WebView in compose Loading each time is an issue
I have applied accompanist webview in compose. Now if i open the composable again the url is loading each time i click which i dont want. What can i do here
1
vote
3
answers
42
views
In which way, Jetpack Compose refresh its Views?
In Compose introduction, it says Compose can refresh the view which needs to update.
The question is how Compose knows which view to update? Dose Compose have a binding between view and data in ...
-1
votes
1
answer
64
views
Jetpack Compose UI not updating when stateflow changes
So, I have a chat app with a counter for how many messages user can send (that part is happening on backend when user is created). I'm using mutableStateFlow with initial value of null. It gets ...
-1
votes
0
answers
22
views
Getting below error after android project upgraded to SDK 34 and added jetpack compose support to one of the module [closed]
org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled:
The root cause java.lang.NoClassDefFoundError was thrown at: org....
0
votes
1
answer
41
views
Difficulty returning a value from a Room Database
I feel I'm so close to grasping this Room database thing. I have the database running fine and I can add records, search and delete but I am unable to figure out how to Sum a column and use the ...
0
votes
0
answers
13
views
ClassCastException encountered while using loginViewModel: androidx.navigation.NavBackStackEntry cannot be cast to androidx.activity.ComponentActivity
I add login and sign up functionality to android kotlin app and I encounter this error ClassCastException for using loginViewModel and signupViewModel in app navigation. How can I resolve this?
...
1
vote
1
answer
51
views
How to set size in rememberAsyncImagePainter in jetpack compose
I am getting image from the url with size. For example size is coming 120x40.
@Composable
private fun RowScope.PanelLogo(logo: Logo?) {
val imageUrl = logo?.url
val imageWidth = logo?.width!!
...
-1
votes
0
answers
9
views
Failed resolution of: Landroidx/compose/runtime/PrimitiveSnapshotStateKt;
After releasing the apk, I can't open the program and it crashes, but I don't have this problem in debug
Failed resolution of: Landroidx/compose/runtime/PrimitiveSnapshotStateKt;
at androidx.compose....
0
votes
0
answers
14
views
Android - Compose - Create a Custom shape
I've been trying to make this shape in compose
I feel like I'm pretty close to it but I can't find a way to make the rounded shape at the bottom.
I tried using the bezier curve with cubicTo but I can'...
1
vote
1
answer
31
views
How to correctly get the path of Room database on os versions >= 26 sdk?
Since I could not preform a migration successfully, I decided to go ahead with a new database. I have one named Cars.db in the current version of app and in the new version the app will create a new ...
0
votes
0
answers
16
views
How can I change the area of Ripple effect for IconButton in jetpack compose?
I want to change the area of Ripple effect for IconButton in Jetpack Compose.
IconButton(
onClick = { viewModel.toggleAudio() },
modifier = ...
-1
votes
1
answer
35
views
How to invoke @Composable function from DrawScope in Jetpack Compose?
I draw bar chart. I want to draw at the end of list loading bar with animation(as a separate function) but I cant invoke @Composable function.
Error:
@Composable invocations can only happen from the ...
-2
votes
1
answer
45
views
What to user After Accompanist webview is deprecated? [closed]
WebView wrapper for Jetpack Compose
A library which provides a Jetpack Compose wrapper around Android's WebView.
Warning
This library is deprecated, and the API is no longer maintained. We recommend ...
0
votes
0
answers
22
views
Compose is recompose whole screen when updating text in edit text
I'm using compose in my android app and I uses the approach of data class to put all the states on it and update the data class by using copy function and update what I want to update in the data ...
0
votes
2
answers
28
views
Android compose animation given by custom function
As a side project I am making a small android app with jetpack compose. I would like to animate an offset of an image according with preset mathematical functions, let's take f(x) = exp(x) and f(x) = \...
0
votes
1
answer
24
views
Why doesn't my UiState(stateflow object) update after updating in the viewmodel?
I update the uiState in the model by the updateSelectedCategory(category = selectedCategory) function, I checked through the logs int the viewmodel, everything is fine, it is updated. But, when I ...
0
votes
1
answer
20
views
Android Jetpack Compose Navigation Recomposition Multiple times
I am trying to use jetpack compose. But when I tried to use jetpack compose navigation, I found that navigated screen is recomposed multiple times. Following is my code snippet.
class MainActivity : ...
1
vote
1
answer
27
views
Navigation Compose animation is always using the default transition
I just migrated to navigation compose version 2.7.3 and am trying to implement the new animations. My issue is the animations don't work on some of the screens and is always the default fade animation....
0
votes
2
answers
36
views
Where is the reset icon?
I want to use a reset icon. The closest one I could find is Icons.Default.LockReset after adding "androidx.compose.material:material-icons-extended:1.5.1", but there is a lock in the middle....
0
votes
0
answers
21
views
Jetpack Compose Why We Need Dialog ? Dialog vs Box
I'm wondering why/when we need to use Dialog composable instead of using Box. Let me explain
Using dialog composable
@Preview
@Composable
fun DialogPreview() {
var isDialogVisible by remember {
...
0
votes
1
answer
19
views
Expandable NavigationDrawerItem - Android Jetpack Compose
I am using jetpack compose / Kotlin to create my first android app.
I am using a navigation drawer like so
ModalNavigationDrawer(
drawerContent = {
ModalDrawerSheet {
Text(text ...
0
votes
0
answers
9
views
BroadcastReceiver not receiving Intent in the same Composable in Android
I’m having a little experiment on android API 26 using Jetpack Compose and I’m having trouble with sending and receiving broadcasts within the same composable.
Here's the code for my receiver:
class ...
0
votes
0
answers
6
views
Compose for desktop Window and Dialog onCloseOperation not working
I am working on a desktop application using Compose for desktop, I want to open a new window when I click on a row of a table, the window opens correctly but it does not close when I click the X ...
0
votes
2
answers
32
views
Unresolved reference: rememberNavController in jetpack compose
I am trying to implement navigation in jetpack compose but I have added the following dependency as described in google docs
implementation "androidx.navigation:navigation-compose:2.7.3"
but ...
0
votes
1
answer
40
views
Returning a variable from a coroutine in Kotlin with Room Database
Hi there and thank you for considering my question. My app has Room running fine (finally) and I want to return the value of myVal2 from the following code.
From my Repository:
fun getFindTotal(): ...
0
votes
1
answer
22
views
How to use an ImageVector in a Glance widget?
I want to use an ImageVector from androidx.compose.material:material-icons-extended in a Glance widget. As far as I know, the only possibility to add an image to a Glance widget is using androidx....
2
votes
0
answers
23
views
Jetpack Compose Preview background color is different from theme background color
I'm just learnig Compose. I want to make Compose Preview background color setting the same as run app mode. What is wrong with my code?
Preview code
@Preview(showBackground = true)
@Composable
fun ...
0
votes
1
answer
16
views
How to update UI Elements from UDP listening response in Kotlin Compose
I am currently trying to make a mobile app that displays a specific UDP message response after listening process, but for some reason the UI doesn't update from the dummy data I provided. Below are ...
1
vote
0
answers
33
views
Why is my Room database returning "kotlin.Unit" in my Android Jetpack Compose App?
Thank you in advance for taking the time to look at my problem. I'm a hobbyist trying to teach myself Android coding with Jetpack Compose and have run into a problem trying to understand Room ...
1
vote
1
answer
37
views
Trying to learn Android dev via old tutorials, but latest Android Studio includes Compose instead of AppCompatActivity(). How do I turn off Compose?
I'm new to Android Dev, but not a new programmer. Trying to learn via old tutorial material I had collected over the years, only to find that the Android world has moved on to new fangled stuff like ...