I'm using a NavigationDrawer
Activity (predefined view in AndroidStudio) and I need to put (and get) the current fragment to switch between fragments.
I saw in some places to put visible and hidden the fragments but I have more than 3 so I need to identify all the fragments before switch between thems.
How can I solved? I just only find to set Tags at the moment to be displayed or set the visibility.
When you add the fragment, you should use a tag
fragTrans.replace(android.R.id.content, myFragment, "SearchingFrag");
So that later if you want to check if the fragment is visible:
MyFragment Frag =
(MyFragment)getFragmentManager().findFragmentByTag("SearchingFrag");
if (Frag.isVisible()) {
// add your code
}
if you want more help inform me hope you got an idea from my answer
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments