I have general questions about BottomNavigationView. I would like to have a BottomNavigationView in each of my Activities in an App for ordering something (e.g. food). It should have 4 buttoms:
With 'Back' the app should just go back to the previous activity. The buttoms 'Stats' and 'My Orders' should switch to a persistent activity that should not be destroyed when not being displayed. 'My Orders' should display the last orders. The buttom 'Info' should only display some information about the current item or current menu (depending from which activity it is called). So basically I have 2 questions:
I'd appreciate every comment and I'd really appreciate your help.
Single Activity
and Multiple fragments
.
You can do this using Jetpack's Navigation Component
data from an Activity/Fragment to the new calling Fragment
, it can be done by setting arguments on the calling fragment
and then getting it on the called fragment
. If there is something which requires to be dynamic, for example- dishes fragment
, make a single fragment and common layout and load the data dynamically from the backend
.For Setting Arguments, this should help
How to pass a variable from Activity to Fragment, and pass it back?
Note: You can use fragment without using Navigation Components
but you have to use FragmentManager and FragmentTransaction and also have to maintain the Backstack by yourself which could be quite complicated