Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fnovoac/007cbb53c86a5d9bf08a77856f0809ee to your computer and use it in GitHub Desktop.
Save fnovoac/007cbb53c86a5d9bf08a77856f0809ee to your computer and use it in GitHub Desktop.
//Es es solo un Popup para mostrar información, no esperamos hacer algo con la respuesta
//de requerir recibir un input del usuario, debemos cambiar el "null" de la línea 11 por "this"
//y el activity debe implementar DialogInterface.OnClickListener
AlertDialog.Builder dialogInputUserBuilder = new AlertDialog.Builder(this);
dialogInputUserBuilder.setCancelable(false);
// fijamos el titulo del díalogo
dialogInputUserBuilder.setTitle("Ingrese un usuario");
//asignamos una imagen de Android (de preferencia reemplazarla por de nuestro proyecyo)
dialogInputUserBuilder.setIcon(android.R.drawable.ic_input_add);
// fijamos el mensaje
dialogInputUserBuilder.setMessage("Nombre del usuario");
// ver comentario al inicio
dialogInputUserBuilder.setPositiveButton("Grabar",null);
// creamos el díalogo
AlertDialog dialogInputUser = dialogInputUserBuilder.create();
// lo mostramos
dialogInputUser.create().show();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment