BadTokenException - BACK button
<p>I know this topic was asked trillions of times throughout the web, but there is no one place answering it. </p>

<p>in my application, I have a welcome screen. when I run the program end-to-end everything is just fine - open/close activities and show dialogs of all sorts.<br>
but, when I reach the welcome screen and from there pressing the <strong>BACK</strong> button - everything becomes messy:<br>
1) the dialog i want to show cause BadTokenException (i'm using <code>this</code> and not <code>getApplicationContext()</code> ).</p>

<p>2) I tried use try/catch to catch the exception - and it really passed the <code>showDialog</code> line. but then, in the 2nd. run, when reaching a <code>showDialog</code> expression, it throws <code>IllegalStateException: View.com.android.internal.policy.impl.PhoneWindow$DecorView@44a59830 has already been added to the window manager</code>.</p>

<p>moreover, I understand that pressing HOME causes the onPause in the activity, while BACK causes onDestroy, but what goes wrong ??</p>

<p>i'm trying to fix that issue for <strong>more than a week</strong>, but with no success.
any ideas ?</p>
