As shown in the code below, if a Progressdialoge
exists, I want to set a new message to it, and dismiss it after 3 seconds.
In the run-time, what happens is, the old message remains set to the progressdialog
and lasts for 3 seconds and then the progressdialog
dismisses without the new message is set. Any suggestions?
Code:
if ( (location != null) && (mProgreeDialoge != null) ){
mProgreeDialoge.setMessage(PROGRESS_DIALOGUE_MSG01);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Update:
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);