Hi all,
I've got something simple where I want to raise an AlertDialog after
catching this keypress:

@Override
            public boolean onKeyDown(int keyCode, KeyEvent event){
                super.onKeyDown(keyCode, event);
                switch (keyCode){

                case KeyEvent.KEYCODE_BACK:
                        alertDialog= new AlertDialog.Builder(this).create();
                        alertDialog.setTitle("Option");
                        alertDialog.setMessage("Perform?");
                        alertDialog.setButton("Yes", new 
DialogInterface.OnClickListener
() {
                                public void onClick(DialogInterface dialog, int 
whichButton) {
                                        setResult(RESULT_OK);
                                        finish();
                                }});
                        alertDialog.setButton("No", new 
DialogInterface.OnClickListener
() {
                                public void onClick(DialogInterface dialog, int 
whichButton) {
                                }});
                        alertDialog.show();
                        break;

                default:
                        break;

                }
                        return true;
            }

The interesting thing here is that when you hit the back button, you
*do* see the AlertDialog for a split second, but then you're back at
the previous screen you were at.  Almost as if the system is hellbent
on sending the user back to the previous screen, regardless of what
the developer has constructed around this event.

Anyone else see this behavior?  I'm using 1.5r2 here.  Any help would
be appreciated - I'm pretty sure I'm using this correctly and that
this is a bug.

Thanks
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to