3

How to get rid of this, I am using the Google compatibility library for Fragments. I have a the following error in log cat. Where MainMenuScreen is a FragmentActivity.

java.lang.IllegalStateException: Activity has been destroyed
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1314)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:541)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:525)

I am trying to call a method from a fragment which is in fragmentActivity, like the below

MainMenuScreen objMain= new MainMenuScreen();
                    if(SharedVariables.isTablet){

                        objMain.showFragment();}else{....}

And in MainMenuScreen the method is

public void showTrafficCasesDetails(){          
        detailsFragmentRoot.setVisibility(View.VISIBLE);            
        DetailsFrag detailsFrag=new DetailsFrag ();
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();       
        transaction.replace(R.id.mainScreenDetailsFrame, detailsFrag);
        transaction.commit();
    }

1 Answer 1

1

Solved it...

MainMenuScreen objMain=(MainMenuScreen)getActivity(); if(SharedVariables.isTablet){

                        objMain.showFragment();} 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.