Reputation: 633
I have one activity 'A' which has many buttons on it to call several corresponding fragments of another activity 'B'.
Activity 'B' contains a navigation drawer where i have created fragments for all the items that we have in the navigation drawer.
So, how do i immediately launch suppose 'fragment 1' ( i.e one of the items of the navigation drawer), inside Activity B, when Activity A calls Activity B.
Upvotes: 1
Views: 612
Reputation: 2178
Add an extra to your Intent which defines which Fragment should be loaded.
intent.putExtra("fragment","FragA");
In your onCreate in Activity B:
String fragment = getIntent.getStringExtra("fragment");
// Do something to load correct fragment
Upvotes: 3