Reputation: 3331
I have an app using the slider drawer layout used in applications such as Youtube. I have it setup such that there is one main activity in the main view which cycles through multiple fragments that attach themselves onto that activity. So there are 3 main fragments in the navigation drawer that the user can switch to. Then within each of those three main fragments are more fragments that the user can go to by clicking a button in the main fragment. I am wondering what is the best way to manage all these fragments while preserving a backstack and minimizing the need to reload all of them if the user revists a fragment.
Ex flow:
Main Subfragment
1. Contacts -> contact details when a contact is clicked
2. ClientList -> client details when a client is selected
3. InfoPage -> info about each developer
Upvotes: 3
Views: 1478
Reputation:
After reading your question, I would suggest you that in DrawerLayout
, you can create your main list containing selection of Contacts
, ClientList
, and InfoPage
. By selection of any, you can display related info in Lets say DetailFragment
. For example, by selection Contacts
from DrawerLayout
, all contacts will be displayed in DetailFragment
. Now, by clicking of any contact from DetailFragment
it will open / replace current DetailFragment
and show contact details in another Fragment
.
In recent project, I followed the recommended way. I am putting demo link here : NestedFragment
I hope this can help you out.
UPDATE
Kindly add ActionBarSherlock
Library as a reference project to this demo.
Thanks.
Upvotes: 3