Since the whole Activity is re-started, if you don't have a code which
initialized the ProgressDialog again, after orientation change, you
will not get the desired results. So, before orientation change and
after orientation change, you need to save the state of your dialog
and then recreate it.

Thanks and Regards,
Kumar Bibek

On Apr 4, 1:40 am, EvgenyV <[email protected]> wrote:
> Hi all!
>
> I'm using the progress dialog example from Android API Demos
> AlertDialogSamples.java (case DIALOG_PROGRESS). After the orientation
> changed the dialog is freezing with no progress anymore.
>
> What should I change to make the example working properly after
> orientation change?
> The piece of code is following:
>
>         case DIALOG_PROGRESS:
>             mProgressDialog = new
> ProgressDialog(AlertDialogSamples.this);
>             mProgressDialog.setIcon(R.drawable.alert_dialog_icon);
>             mProgressDialog.setTitle(R.string.select_dialog);
>
> mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
>             mProgressDialog.setMax(MAX_PROGRESS);
>
> mProgressDialog.setButton(getText(R.string.alert_dialog_hide), new
> DialogInterface.OnClickListener() {
>                 public void onClick(DialogInterface dialog, int
> whichButton) {
>
>                     /* User clicked Yes so do some stuff */
>                 }
>             });
>
> mProgressDialog.setButton2(getText(R.string.alert_dialog_cancel), new
> DialogInterface.OnClickListener() {
>                 public void onClick(DialogInterface dialog, int
> whichButton) {
>
>                     /* User clicked No so do some stuff */
>                 }
>             });
>             return mProgressDialog;
>
>         mProgressHandler = new Handler() {
>             @Override
>             public void handleMessage(Message msg) {
>                 super.handleMessage(msg);
>                 if (mProgress >= MAX_PROGRESS) {
>                     mProgressDialog.dismiss();
>                 } else {
>                     mProgress++;
>                     mProgressDialog.incrementProgressBy(1);
>                     mProgressHandler.sendEmptyMessageDelayed(0, 100);
>                 }
>             }
>         };
>
> Thanks in advance,
> Evgeny

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to