Top "Fragmentmanager" questions

FragmentManager is an interface for interacting with Fragment objects inside an Activity in Android.

How to add/remove Fragment on Button click?

At present I have got a "RELATIVE_LAYOUT" container which I am using for adding my fragment. I am using …

java android android-fragments fragmenttransaction fragmentmanager
How to save state in fragment

I have 4 button to replace fragment in activity [fragment A , fragment B , fragment C , fragment D] and then I replace …

android android-fragments fragmentmanager
Android onBackStackChanged() not called

I have an Activity like the code below: public class AuthenticatedMainActivity extends Activity implements FragmentManager.OnBackStackChangedListener{ @Override protected void onCreate(…

android android-fragments fragmentmanager
How to get current fragment from MainActivity

I've done some research but I really couldn't find the answer. I have single activity with side menu, and holder. …

android android-fragments fragmentmanager
How to avoid adding same fragment to stack

I need some help. em adding fragment to activity this way. problem is on each call of openFragment it create …

android android-fragments stack android-fragmentactivity fragmentmanager
Check if a fragment exists and reuse it

I'm using the following code to create a fragment everytime the user click on an item in a list view. …

java android android-fragments fragment fragmentmanager
java.lang.IllegalStateException(Can not perform this action after onSaveInstanceState)

I am getting this error with following message in different scenario: Activity has been destroyed and Can not perform this …

android android-fragments illegalstateexception fragmentmanager
How to clear fragmentManager back stack without poping fragments?

Simple question but seems impossible to answer... How to clear fragmentManager back stack without poping fragments? I understand it like …

android fragment back-stack fragmentmanager
An invisible layout behind the fragment is getting clicked:

I have created several fragments and I add the first fragment the following way: mainFragment = (MainFragment) MainFragment.create(); getSupportFragmentManager().beginTransaction() .…

android android-fragments fragmenttransaction fragmentmanager
How to remove previous back stack entry from FragmentManager?

I have an activity in which I am switching fragments using following method: public void setCurrentFragment(Fragment fragment) { FragmentTransaction transaction = …

android android-fragments back-stack fragmentmanager