While cancelling the dialog for the first time, you must be using the
cancel() method. It just cancel's the dialog and does not do any
initialization of the progress bar again when you show the same dialog
again, thats why next time also it showing with 100% progress. There are 2
solutions for this.

1) override  onPrepareDialog(int,
Dialog)<http://developer.android.com/reference/android/app/Activity.html#onPrepareDialog(int,
android.app.Dialog)> method. This is called every time a dialog is shown.
You can clear the sate of the dialog in this. Where as onCreateDialog() is
called only for the first time when you first create the dialog.

2) Instead of cancelling the dialog, call dismiss(). This will remove the
dialog and when you want to show the dialog again, create a new one and
show. This is a bit expensive as you are creating a new dialog each time.

Thanks,
Shashidhar


On Sat, Sep 25, 2010 at 10:52 AM, TreKing <[email protected]> wrote:

> On Fri, Sep 24, 2010 at 11:48 PM, Hudar <[email protected]> wrote:
>
>> But after finished, when I click on the button again, it should analyze
>> again, but what happen was it show progress dialog already at 100% and stuck
>> there, instead of reanalyze and start progress dialog  at 0%.
>>
>
> Sounds like you're simply not resetting the progress value on the dialog.
> Hard to say for sure though without more information.
>
>
> -------------------------------------------------------------------------------------------------
> 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" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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