私は4つのタブA、B、C、Dを持つアプリケーションを開発しました。各タブにはアクティビティが含まれています。4番目のタブでDIはさらに3つのアクティビティX、Y、Zを持っているActivityGroupを追加しました。アクティビティグループを追加した4番目のタブでStackOverflowエラーが発生します。このエラーの修正に協力してください。
これは私のstackTraceです:-
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@62668448 is not valid; is your activity running?
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewRoot.setView(ViewRoot.java:468)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.Window$LocalWindowManager.addView(Window.java:424)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.app.Dialog.show(Dialog.java:239)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.app.AlertDialog$Builder.show(AlertDialog.java:802)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.widget.Spinner.performClick(Spinner.java:257)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.View.onTouchEvent(View.java:4179)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.View.dispatchTouchEvent(View.java:3709)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:852)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
06-30 18:22:26.521: ERROR/AndroidRuntime(1293): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow
これが私がタブを構築している方法です-------
Resources res = getResources();
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Reusable TabSpec for each tabO
Intent intent; // Reusable Intent for each tab
// Create an Intent to launch an Activity for the tab (to be reused)
intent = new Intent().setClass(this,FirstActivity.class);
spec = tabHost.newTabSpec("tab_First");
spec.setIndicator("First",res.getDrawable(R.drawable.ic_tab));
spec.setContent(intent);
tabHost.addTab(spec);
// 2nd tab
intent = new Intent().setClass(this,SecondActivity.class);
spec = tabHost.newTabSpec("tab_Second");
spec.setIndicator("Second",res.getDrawable(R.drawable.ic_tab));
spec.setContent(intent);
tabHost.addTab(spec);
//3rd Tab
intent = new Intent().setClass(this,ThirdActivity.class);
spec = tabHost.newTabSpec("tab_Third");
spec.setIndicator("Third",res.getDrawable(R.drawable.ic_tab));
spec.setContent(intent);
tabHost.addTab(spec);
// 4th tab
intent = new Intent().setClass(this,FourthActivity.class);
spec = tabHost.newTabSpec("tab_Fourth");
spec.setIndicator("Fourth",res.getDrawable(R.drawable.ic_create));
spec.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);