Reputation: 132
I have developed an android application by extending to FragmentActivity
. Everything works exactly as it done. I have put NAVIGATION_MODES
as TABS
. I have a LISTVIEW
inside TAB A
of FRAGMENT A
. When the user clicks on LISTVIEW ITEM
, new Fragment/ACTIVITY
should launch showing the same ACTION BAR
and same TABS
. How can I achieve this.
Please suggest any methods.
Thanks
Upvotes: 1
Views: 516
Reputation: 3727
Get the container of the current Fragment A with the ListView and replace the Fragment inside
so in the onclick method of the listview adapter:
FragmentManager fm = getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(FragmentA.this.getParent().getID(), mNewFragment);
ft.addToBackStack(null);
ft.commit();
since FragmentA.this.getParent().getID()
is very clunky, search for the ID of the Container where FragmentA is located in, and use it instead. R.id.FragmentAContainerID
Upvotes: 1