alert dialog
if (!VerificaConexao(this)) {
AlertDialog alert = new AlertDialog.Builder(this).create();
alert.setTitle("Sem Conexão");
alert.setMessage("Sem intenert, verifique a conexão!");
alert.setButton(AlertDialog.BUTTON_NEUTRAL, "Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alert.setIcon(R.drawable.ic_cast_dark);
alert.show();
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setCancelable(true);
builder.setTitle("Encerrar");
builder.setMessage("Fechar a app?");
builder.setPositiveButton("Confirmar",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//
}
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//
}
});
AlertDialog dialog = builder.create();
dialog.show();