I am quite new to Android programming, so please excuse me for the stupid question >,< Just like the title says, I want to show a AlertDialog/Toast right after my ProgressDialog finishes. How I can do this in the proper way? Note: My handler is only to dismiss the ProgressDialog (pd.dismissDialog()).
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btnDoRegister:
pd = ProgressDialog.show(RegisterActivity.this, "",
"Registering with the server..");
new Thread() {
public void run() {
Looper.prepare();
//(hopefully) thread-safe implementations here
handler.sendEmptyMessage(0);
}
}.start();
if (status == registered) {
//show AlertDialog/Toast here
finish();
} else if (status == notRegistered) {
//show AlertDialog/Toast here
}
break;
}
What is more confusing is, when I tried to debug this, LogCat shows nothing and everything was running perfectly (the alert/toast shows up as expected). But when I tried to run it normally, somehow I feel that this runs too fast and not showing my alert/toast correctly (sounds stupid). Thank you very much for your help.