Here I want to show a second dialog box after first dialog box disappears.I am showing the first one for 5000ms, how can we do this?
Thanks in advance…!
Button signin = (Button) findViewById(R.id.regsubmitbtn);
signin.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
showDialog(0);
t = new Thread() {
public void run() {
register();
try {
Thread.sleep(5000);
removeDialog(0);
e.printStackTrace();
}
}
};
t.start();
}
});
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case 0: {
dialog = new ProgressDialog(this);
dialog.setMessage("Registering...");
dialog.setIndeterminate(true);
dialog.setCancelable(true);
return dialog;
}
}
return null;
}
create a counter which will make a count for how many times the dialog is created and then create a handler through which you will send message whether to show dialog or dismis.
See the following code. It does exactly what you want
Example