Since I am new to Android, I am now thinking on what is the correct way of doing things.
As it stands, the application I'm writing has 4 different screens:
- Screen 1 - list of nodes (main screen)
- Screen 2 - options menu, tableLayout with buttons
- Screen 3 - navigation
- Screen 4 - text details on version etc
These screens can be navigated to/from using a "header" View that is placed on top. The header then has 4 different buttons:
+--------------------+
| menu with buttons |
+--------------------+
| |
| |
| |
| C O N T E N T |
| |
| |
| |
+--------------------+
main.xml is really just a LinearLayout that INCLUDES the header.xml and then the content, in that case the list of nodes in a ListView
options.xml is the same thing almost, it includes the headerxml and then a bunch of buttons...
...and so on with the two other screens.
So, when I press one of the buttons in the header/menu on top the content should be switched to that screen. My question is:
Should I create one Activity for each screen? I read on Google that:
An activity presents a visual user interface for one focused endeavor the user can undertake. So that can be interpreted that I should use one Activity for each of these screens.Should I not create more Activities than the startup, and then just run the setContentView(R.layout.whatever) when I want to change the "content" above?