简体   繁体   中英

Android ProgressDialog thread

How to show ProgressDialog in separate UI thread?

I have the following code:

public boolean myMethod() {

  // show here ProgressDialog in thread

  // long operation, MUST BE NOT in thread, as there's a return value...

  return value;
}

Using Handler, Thread, AsyncTask didn't help...

Is there any way to run ProgressDialog in separate thread and main (long) operation in main thread?

Thanks,

There is only one UI thread. You should never run anything heavy in it. I'm afraid you have to run that in the background and the progress bar in the UI thread.

You might have to do a bit redesigning to achieve that. You can use callbacks to get rid of the return values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM