Tab bar click shows force close-Bad token exception
<p>I have tabbar with 4 tabs,i call activity inside the each tab class.
(i.e) click the tab it calls list activity class,onItemclick call another activity using,</p>

<pre><code>    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);
</code></pre>

<p>But it shows error on ReviewOpportunities.class as badtoken exception in progress dialog.
such as</p>

<pre><code>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
</code></pre>

<p>help me to solve this problem</p>
