0

Some background:

Coming from an iOS background, using UITabbarController is very common and straight forward. Each Tab in the tab controller will change the current view to another UIViewController, and each of these UIViewControllers can have its own NavigationController (which kind of acts as a back stack). So whenever I switch tab, I would resume to the state where I left off.

Now I want to implement the same thing in Android, but it seems like the use of ViewController is different in Android. After digging around, I read that instead of using Activity like UIViewController, I should use Activity to act more like NavigationController, and use Fragments (which is deprecated) to act as UIViewController instead.

However my question is:

Should I be implementing multiple Activities for Bottom Navigation? When I click on each item in the Bottom Navigation should I use an Intent to change Activity? Because from my understanding, using Intent to change Activity will add the new Activity to an Activity back stack, which would prevent me from switching back to whichever Activity I want. If someone could, Please tell me what is the "right" way (if there is one) to structure Bottom Navigation. Thank you all in advance.

andy
  • 195
  • 1
  • 2
  • 15

2 Answers2

0

You can use fragments as UIs, And Use a BottomNavigationView in your activity or you can use some libraries.

Here is a library for better customization: https://github.com/ittianyu/BottomNavigationViewEx

Native Method: https://medium.com/@hitherejoe/exploring-the-android-design-support-library-bottom-navigation-drawer-548de699e8e0

Afinas EM
  • 2,755
  • 1
  • 15
  • 28
0

In Android you should use Viewpager, tablayout and Fragments. Just search for its tutorials. there are lots of them on internet

masoud vali
  • 1,528
  • 2
  • 18
  • 29