我想在tabhost中的listview中显示一个对话框。在这个对话框里面我想放另一个tabhost。
但是当我想在第二个tabhost中添加一个标签时,我得到了这个堆栈跟踪:
java.lang.IllegalStateException: Activity has been destroyed
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1549)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:654)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:621)
at android.support.v4.app.FragmentTabHost.onAttachedToWindow(FragmentTabHost.java:282)
at android.view.View.dispatchAttachedToWindow(View.java:13491)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2713)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2720)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2720)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2720)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2720)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2720)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2720)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1367)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1126)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6041)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:792)
at android.view.Choreographer.doCallbacks(Choreographer.java:596)
at android.view.Choreographer.doFrame(Choreographer.java:557)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:778)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:155)
at android.app.ActivityThread.main(ActivityThread.java:5721)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:11
这是我如何设置我的seconde tabhost:
FragmentTabHost _tabHost = (FragmentTabHost) view.findViewById(android.R.id.tabhost);
_tabHost.setup(_context, getSupportFragmentManager(), android.R.id.tabcontent);
Bundle extras = new Bundle();
extras.putString("profil_id", _id_profil);
_tabHost.setCurrentTab(0);
_tabHost.addTab(_tabHost.newTabSpec("Posts").setIndicator("Posts"), PopupPrefTab.class, extras);
你有任何想法让这项工作?