Android AlertDialog Tip
While working in Android I noticed that AlertDialogs tend to have a nasty habit of disappearing on you when switching from portrait to landscape mode.


Where’d it go?
There is a very simple fix for this. In AndroidManifest.xml simply just add android:configChanges="orientation|keyboardHidden" to each activity which makes use of AlertDialog.
<activity android:label="@string/app_name" android:name=".MainActivity" android:configChanges="orientation|keyboardHidden">
Now your alert windows won’t disappear when your user switches from portrait to landscape mode!

Voila!