- Home /
[Android] Additional Dialog behaviour on focus loss
Hi everyone! Here is my problem: I made a test project for Android to try out some utilities function, the test map just shows some buttons with the Unity GUI, each button calls some function in java which shows an AlertDialog.
I noticed that when i put on Pause/Stop my activity and resume it (by pressing the home button on the device and reopening the unity app, for example), the dialogs won't show anymore (not even by pressing the GUI buttons again).
I have the feeling it's a focus problem (i have to confirm this, tho).
I also noticed that this doesn't happen on common Android apps which use the same code to call the dialogs, so i guess it's something about the Unity behavior.
The code which shows the dialogs is inside a Runnable class which is used with the RunOnUIThread method of the UnityPlayerActivity.
Answer by Mihai_Pendragon · Nov 07, 2011 at 07:05 PM
I resolved this by changing the context i passed to every Dialog with AndroidPlayer.currentActivity ... before that i was obtaining it within the C# code and passing it through JNI but for some reason was giving that problem.
Your answer
![](https://koobas.hobune.stream/wayback/20220613032226im_/https://answers.unity.com/themes/thub/images/avi.jpg)