Here's a workaround:

dialog.setButton(ProgressDialog.BUTTON_NEGATIVE,
getString(R.string.cancel), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
        }
});
dialog.show();
final Button cancelButton =
dialog.getButton(DialogInterface.BUTTON_NEGATIVE);
cancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
                // handle the click
        }
});

Its important to only call getButton() after show() has been called,
or it will return null.

On Mar 20, 5:42 pm, Mark Murphy <mmur...@commonsware.com> wrote:
> TreKing wrote:
> > On Sat, Mar 20, 2010 at 8:26 AM, westmeadboy <westmead...@yahoo.co.uk
> > <mailto:westmead...@yahoo.co.uk>> wrote:
>
> >     The only way I can think of is to use a custom layout but I would
> >     rather keep the default dialog look and feel (rather than trying to
> >     simulate it with my own code).
>
> > Don't think so. I had a lengthy discussion with someone else about this
> > some time ago. The gist is the Dialogs assume you want them gone as soon
> > as you press a button. Why this is assumed is beyond me. But looks like
> > you have to add a custom view with your own buttons that don't make it
> > go away automatically. It shouldn't be that hard to make a layout that
> > looks like the regular progress dialog and then just set that as the
> > view on it.
>
> Or, create a dialog-themed Activity and display it.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> Warescription: Three Android Books, Plus Updates, One Low Price!

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

To unsubscribe from this group, send email to 
android-developers+unsubscribegooglegroups.com or reply to this email with the 
words "REMOVE ME" as the subject.

Reply via email to