0

如何在单独的 UI 线程中显示 ProgressDialog?

我有以下代码:

public boolean myMethod() {

  // show here ProgressDialog in thread

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

  return value;
}

使用处理程序,线程,AsyncTask 没有帮助......

有什么方法可以在单独的线程中运行 ProgressDialog 并在主线程中运行主(长)操作?

谢谢,

4

1 回答 1

0

只有一个 UI 线程。你不应该在其中运行任何重物。恐怕您必须在后台和 UI 线程中的进度条中运行它。

您可能需要进行一些重新设计才能实现这一目标。您可以使用回调来摆脱返回值。

于 2010-12-20T11:54:56.580 回答