I believe the right way to fire a ProcessDialog is thru a Handler
try the following...
-- create a Handler and processDialog somewhere before doStuff()
private final Handler handler = new Handler();
private ProcessDialog processDialog;
-- your doStuff method should look like this
void doStuff() {
fireProcessDialog();
/*
do your stuff,
typically a network operation
*/
doSomeNetworkingOperation();
// dismiss the dialog
myProgressDialog.dismiss();
}
private void fireProgressDialog() {
Runnable updater = new Runnable() {
public void run() {
myProgressDialog =
ProgressDialog.show(layout.getContext(),"Please
wait...", "Downloading
content...", true);
}
};
handler.post(updater);
}
On Apr 9, 4:10 am, petunio <[email protected]> wrote:
> Hi everybody
>
> I am having a problem displayin a ProgressDialog. I hope someone can
> show me what I am doing wrong...
>
> void doStuff()
> {
> myProgressDialog = ProgressDialog.show(layout.getContext(),"Please
> wait...", "Downloading content...", true);
>
> /*
> Here I do my stuff
> */
> myProgressDialog.dismiss();
>
> }
>
> The problem is that the progressDialog is not shown inmediately.
> I have tried doing layout.invalidate(), or layout.postInvalidate(),
> and still the same:
> the progressDialog is only shown if, for example, I remove the .dismiss
> () instruction, and I call the doStuff() again
>
> so, the progressDialog is there, but I dont know how to show it
> inmediately
>
> any ideas?
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---