Forgot to add this one thing from logcat:
E/WindowManager( 1804): Activity com.rmfdev.testApp has leaked window
com.android.internal.policy.impl.phonewindow$decorv...@431b5518 that was
originally added here
E/WindowManager( 1804): android.view.WindowLeaked:
Activity com.rmfdev.testApp has leaked window
com.android.internal.policy.impl.phonewindow$decorv...@431b5518 that was
originally added here

Perhaps I'm not using the AlertDialog as it was designed to?

On Fri, May 29, 2009 at 12:36 AM, Rob Franz <rob.fr...@gmail.com> wrote:

> 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to