Questions tagged [navigation-compose]
19 questions
11
votes
1 answer
How to do Assisted Injection with Navigation Compose?
I've a composable called ParentScreen and a ViewModel named ParentViewModel. Inside the ParentViewModel, I am collecting a value from my repo.
class MyRepo @Inject constructor() {
fun getParentData() = System.currentTimeMillis().toString() //…

theapache64
- 10,926
- 9
- 65
- 108
5
votes
1 answer
Jetpack Compose Navigation - Passing local file location as string
I am trying to pass audio file location(/storage/emulated/0/Android/media/...) as string from first screenhome_screen to second screendetail_screen,
When I pass normally above string as a parameter I am getting this…

iamkdblue
- 3,448
- 2
- 25
- 43
5
votes
3 answers
Screens are flashing when I navigate to them in Dark theme using Navigation-compose
I am using Navigation-Compose in my app :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
ComposeTheme {
val navController = rememberNavController()
…

Ali
- 9,800
- 19
- 72
- 152
4
votes
1 answer
How to integrate AlertDialog with Navigation component in Jetpack Compose?
I am using Jetpack Compose and the Android navigation component. When I am on a screen with an AlertDialog, I am unable to navigate back. I guess it's due to the AlertDialog catching the back button event. However I don't know how to connect the…

stefan.at.kotlin
- 15,347
- 38
- 147
- 270
3
votes
0 answers
Navigation in Jetpack Compose - Fragments/ViewModels
So I'm checking this official Compose tutorial https://developer.android.com/courses/pathways/compose
There is Jetpack Compose Navigation
https://developer.android.com/codelabs/jetpack-compose-navigation
So basically in that sample there is just one…

user924
- 8,146
- 7
- 57
- 139
2
votes
1 answer
How to prevent entire composable from recomposing when popping backstack in navigation composable
What currently is happening:
I have a grid screen and on clicking on the list I navigate to the detail
screen
Now on clicking the back button I navigate back to the list screen
What is the issue:
If I have scrolled to the 20th item and navigated…

Devrath
- 42,072
- 54
- 195
- 297
2
votes
0 answers
Jetpack Compose Navigation Deep Link causes duplicate activity
I'm trying to show a notification that when clicked will open ChatScreen. It does open ChatScreen but started as a different activity, so there's 2 MainActivity in the back stack.
I use Compose Destinations, a wrapper library for Compose…

Risal Fajar Amiyardi
- 749
- 6
- 23
2
votes
1 answer
How to handle state flow on back navigate on compose
I am following unidirectional flow in compose for ui state so basically i have sealed class as follow
sealed class UiState{
objet Loading:UiState()
object Success:UiState()
object Error(val error:String):UiState()
}
and in viewmodel
private val…

Kartik
- 21
- 1
2
votes
2 answers
compose navigation handle when composable returned after back
Let's say I have 2 screens HomeScreen and DetailScreen and use compose navigation to navigate between screens.
The graph is HomeScreen -> DetailScreen.
When I pressed back on DetailScreen and returned to HomeScreen I want HomeScreen reacted to that…

galihif
- 310
- 1
- 8
2
votes
1 answer
Compose navigation lose state after pop screen (navigate for network success)
I am using compose navigation with single activity and no fragments.
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
…

jiechic
- 81
- 6
2
votes
1 answer
How can be saved the destinations of nested navigation graph's id in the bottom navigation Jetpack Compose?
I am facing some problems with navigation's back stacks in Jetpack Compose. The following diagram is my desired scenario.
I have bottom bar and two items Home and Setting. And I want to make both as nested graphs. In HomeNavGraph, HomeRootScreen is…

KyawLinnThant
- 617
- 1
- 9
- 20
1
vote
2 answers
Add menu icons from fragement into host actvity toolbar - Navigation component
Iam using single activity navigation component structure.
In host activity iam using navigation drawer and bottom navigation.
So There are 2 frgaments inside bottom navigation Fragment A and Fragment B.
I need to add menu icons (search icon) for…

Navin Kumar
- 3,393
- 3
- 21
- 46
0
votes
1 answer
Navigation to a different screen in jetpack compose
The layout I want to achieve is the following:
Three (3) destinations on the bottom app bar
The first destination ( HOME ) has bottons to access other destinations, for example a settings screen which is opened in full screen.
Here is the code I…

Ait-Gacem Nabil
- 165
- 3
- 12
0
votes
0 answers
ExoPlayer issue using AndroidView in LazyColumn Compose
I am trying to have a videoplayer (using ExoPlayer occupying half of the screen's height) at the top of the LazyColumn and list of items below the video player using compose. The list of items redirects to a details screen. I am using navigation…

srinu
- 1
- 2
0
votes
0 answers
How navigate to graph with all its destinations to the top of the back stack (remove the old one and put it on top)?
When I navigate to some graph (for example graph2), I want to move the entire graph with all its destinations to the top of the back stack (remove the old one and put it on top). How can this be done?
In the image, what I mean…

Ригхард Чан
- 5
- 2