how to show dialogs in android taking screen orientation changes into account
问题 this is driving me crazy. i have read the documentation for creating dialogs in Android and it seems to make sense, except when the screen orientation changes. I have Activity.onCreateDialog() where I create the dialog. I also have Activity.onPrepareDialog() where I prepare the dialog. Then in my Activity.onCreate() method, I call showDialog(id) that's all well and good and behaves properly. now comes the tricky part. I rotate the screen. it destroys the activity and creates a new one.