Hi Aleksei! thanks for the post, I have a doubt though: when we want to pass data to the previous screen, isn't working to do in composable2: navController.previousBackStackEntry?.savedStateHandle?.set("key", it) and then in the viewmodel1 getting the value by: savedStateHandle.get("key").
Any way to get it back there in viewmodel1? thanks!
If you know how to navigate back from Screen2 to Screen1 and send data back. I.e.: in screen two the user types a text and once it presses system's back button, it navigates back to screen one and that text he typed earlier has to appear now in a textfield in screen1.
You can use BackHandler, it overrides system back button. Here you are an example with navigation with arguments.
As I mentioned in the article it's not the best practice, but like a variant... Better try another approach.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Aleksei! thanks for the post, I have a doubt though: when we want to pass data to the previous screen, isn't working to do in composable2: navController.previousBackStackEntry?.savedStateHandle?.set("key", it) and then in the viewmodel1 getting the value by: savedStateHandle.get("key").
Any way to get it back there in viewmodel1? thanks!
Hello
Didn't understand. More details, pls.
If you know how to navigate back from Screen2 to Screen1 and send data back. I.e.: in screen two the user types a text and once it presses system's back button, it navigates back to screen one and that text he typed earlier has to appear now in a textfield in screen1.
You can use BackHandler, it overrides system back button. Here you are an example with navigation with arguments.
As I mentioned in the article it's not the best practice, but like a variant... Better try another approach.