Skip to content Skip to sidebar Skip to footer

Calling Supportfragmentmanager From Pausehandler Implementation

I am trying to implement the PauseHandler described here: https://stackoverflow.com/a/8122789/1977132 My activity is an ActionBarActivity, the code in the processMessage method whi

Solution 1:

First of all, ActionBarActivityis now deprecated. You probably should use AppCompatActivity to be able to support previous Android version.

Second, you should specify the container where to put your State fragment, with the method .replace(int ontainerViewId, Fragment fragment). Your method should look like this:

finalFragmentstate=newState();
finalFragmentManagerfm= getSupportFragmentManager();
finalFragmentTransactionft= fm.beginTransaction();
ft.replace(R.id.your_container_id, state);
ft.commit();

Hope it helps!

Solution 2:

I had the same problem as yours, I think you should change

import android.support.v4.app.DialogFragment

to

import android.app.DialogFragment;

in your DialogFragment class

Post a Comment for "Calling Supportfragmentmanager From Pausehandler Implementation"