I.e. Does the Activity act correctly after you press it? I noticed this difference in your code: builder.
SetPositiveButton("OK", new AlertDialog.OnClickListener() builder. SetNegativeButton("Cancel", new DialogInterface.OnClickListener() The first line uses AlertDialog. OnClickListener and the second uses DialogInterface.
OnClickListener I just checked my code and all my dialogs use DialogInterface. OnClickListener I'm not sure if it makes any difference but it might be worth trying DialogInterface. OnClickListener with your 'OK' button.
I.e. Does the Activity act correctly after you press it? I noticed this difference in your code: builder.
SetPositiveButton("OK", new AlertDialog.OnClickListener() builder. SetNegativeButton("Cancel", new DialogInterface.OnClickListener() The first line uses AlertDialog. OnClickListener and the second uses DialogInterface.OnClickListener.
I just checked my code and all my dialogs use DialogInterface.OnClickListener. I'm not sure if it makes any difference but it might be worth trying DialogInterface. OnClickListener with your 'OK' button.
Thanks Gary. It's DialogInterface. OnClickListener at first, and then changed to AlertDialog.
OnClickListener after a couple of times unsuccessful tries. I got the same result by using DialogInterface. OnClickListener or AlertDialog.
OnClickListener – Patrick May 20 at 5:48 OK. And cancel works fine? You might want to remove this line: new AlertDialog.
Builder(this).create().show();. I'm not sure why it's there but it could be causing issues. – Gary Buyn May 20 at 6:00 I made a mistake.
I forgot deleting the first line (just for try purpose) in method onCreateDialog:new AlertDialog. Builder(this).create().show(); and then it works fine... – Patrick May 20 at 6:01 Big thanks to Gary – Patrick May 20 at 6:04 No worries Patrick. – Gary Buyn May 20 at 6:06.
Remove new AlertDialog. Builder(this).create().show(); from your code. It will work absolutely fine.
I have an Activity with a button, click the button to show an AlertDialog, that works fine. After the AlertDialog disappears, the Activity seems lose its focus, that means it can not receive any touches on it anymore. After clicking on "Show" button on the Activity, the AlertDialog appears.
After clicking on "OK" button on the AlertDialog, the AlertDialog disappears. The Activity can not receive any touches. If I click the "BACK" button of the emulator, then the Activity can receive touches again, and from then on, it will work quite good, e.g. Click "Show" button again, and then click "OK" again, after the AlertDialog disappears, the Activity is OK to receive touches without another click on the "BACK" button of emulator.
So, could anyone tell me how to tackle this problem(the Activity can not receive touches for the first time)?
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.