-
-
Save parzibyte/fa87f5a8a9cf6dcf8864ed511be6eba5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AlertDialog dialogo = new AlertDialog | |
.Builder(MainActivity.this) // NombreDeTuActividad.this, o getActivity() si es dentro de un fragmento | |
.setPositiveButton("Sí, eliminar", new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
// Hicieron click en el botón positivo, así que la acción está confirmada | |
} | |
}) | |
.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
// Hicieron click en el botón negativo, no confirmaron | |
// Simplemente descartamos el diálogo | |
dialog.dismiss(); | |
} | |
}) | |
.setTitle("Confirmar") // El título | |
.setMessage("¿Deseas eliminar Compra de galletas?") // El mensaje | |
.create();// No olvides llamar a Create, ¡pues eso crea el AlertDialog! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment