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!


Power Cost Estimator

I just released an Android app for a grad school project called Power Cost Estimator. It’s basically a calculator that can estimate your electric bill based on usage. You can find it here

I also made a tutorial for new users which can be found here.