- Developer's Commute
- Posts
- Do you understand multiple back stack in navigation- Developers Commute
Do you understand multiple back stack in navigation- Developers Commute
we will explore more about the multiple Back Stack In Navigation some interesting tweets, articles, memes and Coding motivation
Good Morning, It’s your captain speaking. Welcome aboard the Developer’s Commute. Today we will explore more about the multiple Back Stack In Navigation some interesting tweets, articles, memes and in the end, Coding Motivation to keep you moving We hope that you enjoy this ride with us and you have a pleasant journey ahead.
Code Philosophy
Multiple Back Stack In Navigation
The flow of an app’s UI is a crucial part. If the flow is not good it will lead to less user retention. Therefore developers should keep flow in mind while developing navigation of the app.
When I was developing an app based on XML, its navigation was not saving the back stack. So, I decided to learn about multiple backstacks and their manual implementation.
In this newsletter, we will explore more about multiple backstacks and how to implement them.
If you are using newer versions of navigation it automatically saves the backstacks. So, we did not need to implement it manually. But in the older versions, the back stack needed to be implemented manually. Android’s engineers gave us an extension function that could be used with the navigation to save the back stack.
Let's explore the basics of implementing the backstack manually.
To implement multiple back stacks in the navigation we need to implement a stack for individual tabs in the bottom bar. These individual backstacks maintain their state while we navigate between different screens. That forms the basics of multiple backstacks.
If you want to explore more about its implementation. I would suggest that you watch this video.
With the newer version of Android Navigation, we can implement back-stack easily.
In the case of XML :
-In navigation, XML the <action> tags contain attributes that can be used to save Multiple backstacks.
XML Back Stack
—> popupToSaveState - helps us to pop up the navigation stack up a destination desired
—> popUpTo - Saves the destination which popup To Save State pops
—> restore State - It restores the previous saved state
—> destination - It restores the destination defined in this tag
In the case of Jetpack Compose:
-In navigation, Jetpack compose contains options that can be used to save Multiple backstacks
Jetpack Compose Back Stack
—> popUpTo - It finds the Start destination of the navigation
—> saveState - Saves the state of the first destination
—> restore state - It restores the previously saved state
—> launching Single Top - It helps us avoid multiple copies of the same composable
This is for today I hope enjoyed this newsletter. If you enjoyed it please let me know and if I have written something wrong please forgive me.
Thank you for reading
Regards,
Developer Commute’s Captain
Free Ebook
Developer Meme
Tweets That You Might Love
Exploring Interesting Tweets
Tweets That You Will Find Interesting
Habit Kit App Review
Here is an interesting tweet for you →
Building Habits is hard!
Why?
It's hard to keep track of them
So I set out to find a simple habit tracker
Easy to use and No BS
Here is what I found:
— Hitesh Kohli | Android Developer (@Hitesh__kohli)
3:38 PM • Nov 29, 2023
Learn about Kotlin Flows
Then you might find this tweet interesting→
Android Developer aye?
Do you understand Kotlin Flows?
StateFlow vs SharedFlow
Do you understand the difference between the two?
Here is everything:
— Hitesh Kohli | Android Developer (@Hitesh__kohli)
2:25 PM • Nov 28, 2023
Do you want to learn about Backend development as an Android developer?
Here is something interesting for you→
Android Developer aye?
If you are an app developer, you should not only understand app development but also backend dev.
Why?
If you have no idea how the basics of the backend work.
It is hard to write code for the frontend
Here is everything you want to know:
(1/20)
— Hitesh Kohli | Android Developer (@Hitesh__kohli)
12:33 PM • Nov 18, 2023
ArticlesThat You Might Love
Exploring Interesting Articles
Articles That You Will Find Interesting
Multiple back stacks
Here is an interesting article that you might want to check out →
Kotlin Functions Every Developer Should Know with Examples
Here is an interesting article for you →
Why do you think users like apps over websites?
Here is an interesting article for you →
Developer Motivation
What do you think?