标签栏单击显示强制关闭 - 错误标记例外

时间:2012-02-20 09:42:06

标签: android

我有4个标签的tabbar,我在每个标签类中调用活动。 (即)单击它调用列表活动类的选项卡,onItemclick使用,

调用另一个活动
    oid=roppor.get(pos).get("OID").toString();
    Intent i = new Intent();
    i.setClass(ReviewOpp.this,ReviewOpportunities.class);
    i.putExtra("oid", oid);
   // startActivity(i);
    View view = getLocalActivityManager()
            .startActivity("Review opportunities", i
            .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))
            .getDecorView();
    this.setContentView(view);

但是它将ReviewOpportunities.class上的错误显示为进度对话框中的badtoken异常。 比如

02-20 15:09:44.884: ERROR/AndroidRuntime(8896): FATAL EXCEPTION: main
02-20 15:09:44.884: ERROR/AndroidRuntime(8896): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jems.salesplanning/com.jems.salesplanning.ReviewOpportunities}: android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@44c5d1d0 is not valid; is your activity running?
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.app.ActivityThread.startActivityNow(ActivityThread.java:2503)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at com.jems.salesplanning.ReviewOpp.onItemClick(ReviewOpp.java:290)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.widget.AdapterView.performItemClick(AdapterView.java:284)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.widget.ListView.performItemClick(ListView.java:3382)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.widget.AbsListView$PerformClick.run(AbsListView.java:1696)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.os.Handler.handleCallback(Handler.java:587)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.os.Handler.dispatchMessage(Handler.java:92)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.os.Looper.loop(Looper.java:123)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at java.lang.reflect.Method.invokeNative(Native Method)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at java.lang.reflect.Method.invoke(Method.java:521)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at dalvik.system.NativeStart.main(Native Method)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896): Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@44c5d1d0 is not valid; is your activity running?
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.view.ViewRoot.setView(ViewRoot.java:505)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.view.Window$LocalWindowManager.addView(Window.java:424)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.app.Dialog.show(Dialog.java:241)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.app.Activity.showDialog(Activity.java:2556)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.app.Activity.showDialog(Activity.java:2514)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at com.jems.salesplanning.ReviewOpp.onCreate(ReviewOpp.java:63)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at com.jems.salesplanning.ReviewOpportunities.onCreate(ReviewOpportunities.java:91)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-20 15:09:44.884: ERROR/AndroidRuntime(8896):     ... 16 more

帮我解决这个问题

0 个答案:

没有答案