All Questions
Tagged with android-jetpack-compose kotlin-coroutines
210
questions
0
votes
0
answers
6
views
Timer Increments By One Whenever User Tries To Reset It Back To Zero In Android
I made a standard stopwatch app in Android Studio using jetpack compose. It gives the user the ability to reset the stopwatch back to zero, however there is a problem. The stopwatch will reset back to ...
1
vote
2
answers
27
views
Unable to create updated UI with new image in JetPack Compose
I'm trying to create simple Dice Roller JetPack Compose App. I create an Image compose and button compose. Whenever I click on the button, log statement shows button is clicked but I'm unable to ...
0
votes
1
answer
31
views
How i can re-execute StateFlow in ViewModel Android? I have use case where i needs to do refresh of data
I am trying re-execute StateFlow in ViewModel (refresh something, new API request...), but it not work. This is my simple example about counter:
Viewmodel
class CounterViewModel(
private val ...
2
votes
0
answers
46
views
Jetpack Compose CRUD application views don't refresh
I'm new to Android Compose. I'm generally teaching my daughter how to code and we decided to start with something that has an UI,so we chose Android to start. I made an app in Jetpack Compose and I ...
1
vote
0
answers
24
views
How Do You Pass A Function Into Foreground Services In Android Studio
I'm trying to create an application in Android Studio that consists of a timer that runs in the background. To achieve this I'm passing the timer functionality into a foreground service class. However,...
1
vote
1
answer
43
views
I would like some help regarding an async between a compose navigation and a ViewModel update
I'm quite new to android kotlin and i have a little problem regarding my login. When i press the login button i immediately get directed to the home screen but before the ViewModel can be updated so i ...
0
votes
1
answer
53
views
how to fix this warning "GlobalScope, This is a delicate API and its use requires care"?
I'm currently learning how to build a Music App using compose and media3. onIsPlayingChanged(isPlaying: Boolean) in this method I'm using GlobalScope, Android studio give me this waring "This is ...
2
votes
1
answer
63
views
Kotlin coroutines supervisorscope, child job cancels all sibling jobs, why?
In kotlin coroutines I studied supervisorscope won't cancel the sibling jobs if one of the job get cancelled or thrown exception in it. In IntelliJ it works good, but in Android Project it throws the ...
0
votes
0
answers
64
views
How to update uiState in ViewModel when an event occurs?
I'm just learning how to manage UI States. In the following example I'm using combine() for 2 of my use cases and they are collected when the app starts. But what if I want to collect a 3rd different ...
1
vote
0
answers
14
views
Can't run Retrofit with MockWebServer using TestScope Jetpack Compose
when i try to call frankfurterApi.convert with test scope, the test instantly gets terminated(println("here2") doesn't get called), but with runBlocking everything works good, just like with ...
0
votes
1
answer
66
views
Navigate to next screen when the api call is finished
I want to go to another screen only when the api call is finished. I'm using the below code and it works fine in splash screen (i can see the api call happening in log cat) but when i navigate and try ...
0
votes
3
answers
104
views
Android getting error Hilt when running app
I am getting this error while running my android project, can someone please help.
I have the latest android studio jellyfish installed
and i am using hilt version 2.51.1
error: [Hilt]
Unsupported ...
1
vote
1
answer
74
views
Val variable keeps changing without any reassignment
I've been working on a basic snake game. The problem which is occuring is that when I run the program, the walls (extraWalls variable) are the ones who keeps changing, whereas the snake's coordinates ...
0
votes
2
answers
79
views
java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
I am working on a very basic snake game using kotlin and jetpack compose. To make it more efficient, I thought of using coroutines, but I keep getting the above mentioned error.
Full project is shared ...
1
vote
1
answer
41
views
How can i reflect var changes to rememberSaveable on the screen?
I'm learning Jetpack Compose and I'm having a bit of a problem reflecting the changes of this var, "repeticiones" (repetitions):
var repeticiones by remember { mutableIntStateOf(3) }
The var ...