Home Open a fragment from another fragment always keeps the previous fragment title
Reply: 0

Open a fragment from another fragment always keeps the previous fragment title

user966
1#
user966 Published in April 26, 2018, 5:28 pm

I am working on an Android app that has only one Activity and 8 Fragments. MainActivity has a DrawerLayout with a menu that opens each of the fragments.

Sometimes I need to navigate from one fragment to another directly, I mean, after executing some methods on a fragment, I need to open one of the other fragments.

For example, the user opens fragment B from the side menu, then the users executes some methods on fragment B, and after execution, fragment C should be open.

It works fine, my only issue is that fragment C keeps the fragment title from fragment B, and I need to show the original title from fragment C. This is how am I going from fragment B to fragment C

HomeFragment nextFrag= new HomeFragment();
getActivity().getSupportFragmentManager().beginTransaction()
             .replace(R.id.frame, nextFrag,"findThisFragment")
             .addToBackStack(null)
             .commit();
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.245767 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO