1

I'm a SWIFT developer and trying to migrate to Android and have a few questions that hopefully someone maybe able to help with.

Currently in SWIFT I have an app that has a home screen with bottom TabBar that selects one of four different ViewControllers that have their own NavBar and its this functionality I'm trying to reproduce.

First questions may seem very basic, but hopefully confirms my current thinking:

  • Q. Is an Android Activity the same or similar to iOS ViewControllers?
  • Q. Is an Android Fragments the same or similar to iOS Views?

So far I have an Android App that has a Home Screen thats an Activity within this I have a BottomNavigationView and a top ActionBar (haven't sorted this out yet). Within the Main Activity I want to display the the currently selected View stack.

  • Q. Should I use Activities or Fragments for each of the four stacks?
  • Q. Current thinking is to use Fragments otherwise I'll have to duplicate the ActionBar & BottomNavigationView in each Activity?

So the above covers the high-level structure of the app but it would be good to understand how the navigation works. If I'm not mistaken iOS handles a lot of this under the covers but Android does not have the same concept of NavBars I'll have to use Intents.

Fragments-A1 > Fragments-A2 > Fragments-A3 > Fragments-A4 > Fragments-A5   
Fragments-B1 > Fragments-B2 > Fragments-B3 > Fragments-B4 > Fragments-B5   
Fragments-C1 > Fragments-C2 > Fragments-C3 > Fragments-C4 > Fragments-C5   
Fragments-D1 > Fragments-D2 > Fragments-D3 > Fragments-D4 > Fragments-D5   

So my BottomNavigationView (if this is the best approach) will switch between Fragments A-D.

  • Q. If a user navigates down Fragment A, and is on A4, if they select Fragment D they will be switched to Fragment D1, is this correct?
  • Q. If they then return to Fragment A where do they return to? The root A1 or their previous location A4?

Thanks for any help, and if there's any reference material that helps with the transition I'd really appreciate a link, not so much the Android developer site, but more iOS to Android comparisons, if this use this.

Duncan Hill
  • 547
  • 2
  • 5
  • 16
  • See [this](https://stackoverflow.com/a/28167759/6891637) and [this answer](https://stackoverflow.com/a/7132116/6891637) – Ajil O. Oct 16 '17 at 01:54

0 Answers0