I have a 1) MainActivity. 2) Fragment 1 (Listview) 3) Fragment 2 (Listview) 4) Fragment 3 (Textview)
I can successfully launch Fragment 1 when the app is first started. Then, once i click on any listitem on Fragment 1, Fragment 2 is launched. I've handled both these fragments with the following condition in order to differentiate inside my MainActivity
if (this.getIntent().getExtras()
== null) {
fragmentManager.beginTransaction()
.replace(R.id.restaurantlist, Fragment1).commit();
} else {
String id = String.valueOf(getIntent().getExtras().getString(
"restaurant_id"));
fragmentManager.beginTransaction()
.replace(R.id.offerlist, Fragment2).commit();
}
Now how do i move to Fragment 3 by clicking a list item on Fragment 2? Right now, im also using putEctra AND getExtra "id". For Fragment 2 and Fragment 3. But how do i use it to differentiate inside the above code?