Question

i'm using jfeinstein10/SlidingMenu for sliding menu i want change the content of menu item on selecting rectangle button in fragment
When try to replace content with new fragment using switchcontent i get error like this

> 04-03 13:02:20.093: E/AndroidRuntime(6498): FATAL EXCEPTION: main
04-03 13:02:20.093: E/AndroidRuntime(6498): java.lang.IllegalStateException: Activity has been destroyed
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1342)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:595)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:574)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at com.akiland.slidingmenuexample.MainActivity.switchContent1(MainActivity.java:82)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at other.PipeSel$1.onItemClick(PipeSel.java:47)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.widget.AdapterView.performItemClick(AdapterView.java:298)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.widget.AbsListView.performItemClick(AbsListView.java:1100)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.widget.AbsListView$PerformClick.run(AbsListView.java:2749)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.widget.AbsListView$1.run(AbsListView.java:3423)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.os.Handler.handleCallback(Handler.java:725)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.os.Looper.loop(Looper.java:137)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at android.app.ActivityThread.main(ActivityThread.java:5041)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at java.lang.reflect.Method.invokeNative(Native Method)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at java.lang.reflect.Method.invoke(Method.java:511)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-03 13:02:20.093: E/AndroidRuntime(6498):     at dalvik.system.NativeStart.main(Native Method)
Was it helpful?

Solution 2

Solved changed menu content by

getActivity().getSupportFragmentManager()
            .beginTransaction()
            .replace(R.id.menu_frame,fragment)
            .commit();
            }

on the fragment

OTHER TIPS

The Menu you will be putting in a layout rite? In that case , Have two layouts/Views in the main menu layout. Have one Layout/View 's Visibility to View.Visible and other's to View.Gone. When the button click is fired, toggle the visibility of the layout/View

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top