Hello,

I have a framelayout where I am adding a listfragment and adding it to 
backstack. If user selects an item in that list, I start a new transaction 
and replace the last fragment with a new one. But when I press back button, 
I dont see my first list fragment, rather I see the original splash screen.

Do I have to replace fragments in same transactions to be able to navigate 
back to last fragment?

Here is my code:

//Adding first fragment:
private void addRouteCategoryFragment(){
        FragmentManager fm       = getSupportFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        ft=fm.beginTransaction();
        ft.add(R.id.fragment_content, new 
RouteCategoryFragment(),ROUTE_CATEGORY_TAG);
        ft.addToBackStack(null);
        ft.commit();
    }

//Once user selects and item in RouteCategoryFragment, I replace it with 
other fragment-
private void handleRuralRoutesClick(){
        FragmentManager fm       = getSupportFragmentManager();
        FragmentTransaction ft = fm.beginTransaction();
        ft.add(R.id.fragment_content, new CountyListFragment(),COUNTY_TAG);
        ft.addToBackStack(null);
        ft.commit();
    }

Thanks

Apurva

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to