【发布时间】:2011-03-02 17:04:34
【问题描述】:
我正在开发我的第一个 Androïd 应用程序,当我想显示 ProgressDialog 以指示正在运行的进程时遇到了问题。 在我的应用程序中,用户通过按下按钮触发了一项耗时的任务。当用户按下按钮时,我的“OnClickListener”的“OnClick”函数被调用。在这个函数中,这是我目前正在做的:
- creation and configuration of an instance of the ProgressDialog class,
- creation of a thread dedicated to the time consuming task,
- attempt to display the ProgressDialog using the "show" method,
- start of the thread,
- main Activity suspended (call of the "wait" function)
- wake up of the main Activity by the thread when it is finished
- removal of the ProgressDialog by calling the "dismiss" function.
一切正常(长时间任务的结果是正确的)但 ProgressDialog 永远不会出现。我做错了什么?
提前感谢您花时间帮助我。
【问题讨论】:
标签: android multithreading progressdialog