I have a process capture system on Android where when something suspicious is detected, it will issue an alert window with some options. I would like to know how I do it when I open any of these options, by pressing the back button, that the application would display the previous warning window.
For example, the main alert window
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Sistema Infectado. Aplicação capturada "+ameaca);
builder.setIcon(R.drawable.alert);
showNotificationWarning(); // NOTIFICAÇÃO DE ALERTA
builder.setItems(new CharSequence[]
{"Desinstalar aplicação", "Ignorar", "Detalhes", "Continuar Monitoramento",},
new DialogInterface.OnClickListener() {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public void onClick(DialogInterface dialog, int which) {
switch (which) {
final AlertDialog.Builder detalhes = new AlertDialog.Builder(MainActivity.this);
detalhes.setTitle("Detalhes");// outra janela de aviso. Gostaria que quando eu estivesse nessa janela, ao apertar o back button, voltasse para a primeira janela de aviso
detalhes.setIcon(R.drawable.settings);