Because it's the old Handler for the old ProgressDialog. A new
ProgressDialog is created when the screen orientation change. That new
progress dialog should have a new handle to take care of it. And the
activity should stop the handler in onDestroy() to avoid keeping it
running for a while after an orientation change.
On Thu, Sep 4, 2008 at 1:31 PM, blindfold <[EMAIL PROTECTED]> wrote:
>
> Adding one debug output line to AlertDialogSamples.java to get
>
> super.handleMessage(msg);
> Log.i("OIC", "mProgress = " + mProgress);
>
> shows that the handler keeps incrementing mProgress under the
> condition that I mentioned, but without dismissing the dialog when
> mProgress reaches 100 (and indeed stops counting). I do not see how
> adding another trigger message could help with this.
>
> Or more explicitly,
>
> mProgressHandler = new Handler() {
> @Override
> public void handleMessage(Message msg) {
> super.handleMessage(msg);
> Log.i("OIC", "mProgress = " + mProgress);
> if (mProgress >= MAX_PROGRESS) {
> Log.i("OIC", "This should dismiss me, but...");
> mProgressDialog.dismiss();
> } else {
> mProgress++;
> mProgressDialog.incrementProgressBy(1);
> mProgressHandler.sendEmptyMessageDelayed(0, 100);
> }
> }
> };
>
> gives
>
> ...
> 09-04 20:11:35.021: INFO/OIC(248): mProgress = 97
> 09-04 20:11:35.127: INFO/OIC(248): mProgress = 98
> 09-04 20:11:35.233: INFO/OIC(248): mProgress = 99
> 09-04 20:11:35.332: INFO/OIC(248): mProgress = 100
> 09-04 20:11:35.332: INFO/OIC(248): This should dismiss me, but...
>
> the dialog remains on the screen if the screen orientation was changed
> during the count.
>
> Or if I add
>
> @Override
> protected void onPause() {
> super.onPause();
> Log.i("OIC", "This too should dismiss me, but...");
> mProgressDialog.dismiss();
> }
>
> then I do get the "This too should dismiss me, but..." upon changing
> the screen orientation somewhere during the count (and the count
> continues), but the progress dialog still does not go away.
>
>
> On Sep 4, 7:05 pm, "Romain Guy" <[EMAIL PROTECTED]> wrote:
>> The bug is just in the sample application: it should call
>> mProgressHandler.sendEmptyMessage(previousProgress) after an
>> orientation change and if the progress dialog is showing. There is no
>> cleanup problem or conflict or anything like this.
>
> >
>
--
Romain Guy
www.curious-creature.org
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---