Problems with Android Dialog and sliding out keyboard
My Android application puts up a Dialog with and Edit Text field. If the dialog is displayed with the slide out keyboard closed and then the keyboard is opened, the dialog box (sometimes) disappears. The application goes off into never-never land. I am using a LG Alley.
Is there an event for opening a keyboard slider? An event I can capture and gain control over this situation? Any 开发者_JAVA百科advice as to how to deal with this?
I think you're possibly seeing the result of a 'configuration change' - see Handling Runtime Changes.
Things like a change in device orientation or opening/closing a 'hard' keyboard cause the currently running Activity to be destroyed and re-created and you need to restore things to the way they were before the change.
Not so much listening for an event but more a case of being able to 'retrace your steps' from the start.
I found that adding this type of statement to the manifest file fixes the problem
android:configChanges="keyboardHidden|orientation"
精彩评论