I typically do something like this, this is largely pseudo-code:

enum SaveOperationState { CONFIRM, PERFORM, CANCEL }

save(SaveOperationState state)
{
    switch (state)
    {
    case CONFIRM:
        confirmDialog.show()
        {
            okButtonListenerMethod  { save(PERFORM); }
            cancelButtonListenerMethod { save(CANCEL); }
        }
        break;

    case PEFROM:
        doSave();
        break;

    case CANCEL:
        doWhateverElse();
        break;
    }
}



On Jul 31, 3:31 pm, Brad Gies <[email protected]> wrote:
> Why not just use the AlertDialog the way it is meant to be used? Even
> though it's not modal, it looks modal the way it works anyway, and you
> just need code a little differently and put all logic that happens after
> the Dialog closes into the ButtonListeners.
>
> What do you need to do that you think you can't accomplish using it
> properly? For a Yes, No confirmation just setup a listener for the
> positive and negative buttons (the same listener if you want).
>
> Brad
>
> On 30/07/2010 7:14 PM, john brown wrote:
>
>
>
>
>
> >> AlertDialog is not "modal" - the call to show() returns immediately, 
> >> leaving
> >> the dialog on the screen and button callbacks active.
>
> > Does this mean that:
> > 1) It is not possible for the AlertDialog to be made "modal" .
> > 2) My implementation of the AlertDialog is not modal. Solve problem
> > with AlertDialog.IsModal = true; (or something like that)
> > 3) or maybe:
> >             boolean buttonPushedFlag = false;
> >             AlertDialog.show();
> >             ..........
> >            do while buttonPushedFlag = false {
> >             }
>
> > How do I accomplish what I need, a yes/no confirmation?
>
> > Thanks, John Brown
>
> > On Jul 30, 3:44 pm, Kostya Vasilyev<[email protected]>  wrote:
>
> >> AlertDialog is not "modal" - the call to show() returns immediately, 
> >> leaving
> >> the dialog on the screen and button callbacks active.
>
> >> This is the reason for the sequence change you're seeing.
>
> >> --
> >> Kostya Vasilyev --http://kmansoft.wordpress.com
>
> >> 31.07.2010 1:37 пользователь "TreKing"<[email protected]>  написал:
>
> >> On Fri, Jul 30, 2010 at 4:31 PM, john brown<[email protected]>
> >> wrote:
>
> >>> What can I do ...
>
> >> Print "after" in response to clicking the dialog buttons.
>
> >> ---------------------------------------------------------------------------
> >>  ----------------------
> >> TreKing<http://sites.google.com/site/rezmobileapps/treking>  - Chicago
> >> transit tracking app for Android-powered devices
>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Android Developers"...
>
> --
> Sincerely,
>
> Brad Gies
> -----------------------------------------------------------------------
> Bistro Bot - Bistro 
> Blurbhttp://www.bgies.comhttp://www.bistroblurb.comhttp://www.ihottonight.com
> -----------------------------------------------------------------------
>
> Never doubt that a small group of thoughtful, committed people can
> change the world. Indeed. It is the only thing that ever has - Margaret Mead- 
> Hide quoted text -
>
> - Show quoted text -

-- 
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