I got this dialog snipet:
String message="This will be my message";
AlertDialog.Builder alt_bld = new AlertDialog.Builder(this);
alt_bld.setMessage(message)
.setCancelable(false)
.setPositiveButton("OK", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
ProgressDialog dialog1 = ProgressDialog.show(CombatActivity.this, "Loading",
"Pushing OK...", true);
Intent i = new Intent();
i.setClass(MyFirstActivity.this, MySecondActivity.class);
startActivity(i);
finish();
}
});
AlertDialog alert = alt_bld.create();
// Title for AlertDialog
alert.setTitle("Nyertél.");
// Icon for AlertDialog
alert.setIcon(R.drawable.icon);
alert.show();
My question is:
Should i call .hide() or .dismiss() in any of these ?
The message text will be dynamicly read, and I dont want a separate instance for every shown dialog. I just want only one with updated messages.
So how and when should i call remove or dismiss ?
Yeah, you have to call
dismiss()before you callfinish(), otherwise the dialog will remain in the background and can cause problem when you try to start other activities.