如下面的代码所示,如果Progressdialoge
存在,我想成立一个新的消息给它,并在3秒后关闭它后解雇ProgressDialog。如何在特定的时间
在运行时,会发生什么情况是,旧消息保持设置为progressdialog
并持续3秒,然后progressdialog
关闭而未设置新消息。有什么建议么?
代码:
if ((location != null) && (mProgreeDialoge != null)){
mProgreeDialoge.setMessage(PROGRESS_DIALOGUE_MSG01);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
更新:
if ((location != null) && (mProgreeDialoge != null)){
mProgreeDialoge.setMessage(PROGRESS_DIALOGUE_MSG01);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
mProgreeDialoge.dismiss();
}
}, FREEZE_PROGRESS_DIALOGUE_TIME);
可能重复:http://stackoverflow.com/questions/3947080/progressdialog-does-not-want-to-update-the-message –