Question

I noticed a problem that seems to only occur on Android 4.3. I'm using a AlertDialog and I dismiss and show it in the onCreate function when an orientation change occurs by storing the dialog state in onSaveInstanceState().

On other versions of android (4.0.x, 4.1.x, 4.2.x, 2.3.x), this works perfectly fine. I can rotate the device multiple times and the dialog will never disappear but on Android 4.3, if I rotate the screen enough, the dialog will disappear but instantly reappear if I rotate the screen again. I noticed that everytime the dialog disappears I'd see a GL_INVALID_OPERATION error in Logcat.

I'm wondering if this is a known bug or if there are any work arounds.

Was it helpful?

Solution

After heavy testing, it appears that this is a timing glitch. I'm not too sure of what's going on in the background but I can guess from the behavior that some GL object are not ready when attempting to display the dialog cause the dialogs not to be drawn.

I found a workaround by just declaring a handler in the class and doing a post event to the handler to show the dialog. It seems to give the activity enough time to intialize everything and the problem no longer occurs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top