I have an activity and a second activity. In the second activity, I need to close the activity and then display an alert to the user back in the first activity again.
Here is the current code I use to bring up the alert and close the activity:
String message = "message";
AlertDialog alertDialog = new AlertDialog.Builder(SecondActivity.this).create();
alertDialog.setMessage(message);
alertDialog.show();
alertDialog.setOnDismissListener(new OnDismissListener()
{
public void onDismiss(final DialogInterface dialog)
{
finish();
}
});
So how can I make it so that the second activity finishes
, and then once back on the first activity, display an alert to the user?
I tried this as well:
String message = "message";
finish();
AlertDialog alertDialog = new AlertDialog.Builder(FirstActivity.class).create();
alertDialog.setMessage(message);
alertDialog.show();
but I get this error:
The constructor AlertDialog.Builder(Class<FirstActivity>) is undefined