-
-
Save parzibyte/3e9a9d3550ef03dc3d97507d0885f675 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.Builder builder = new AlertDialog.Builder(getActivity()); | |
builder.setTitle("Opciones"); | |
builder.setItems(OPCIONES_ALERTA, new DialogInterface.OnClickListener() { | |
@Override | |
public void onClick(DialogInterface dialog, int which) { | |
// which representa el índice del arreglo de opciones | |
String eleccion = OPCIONES_ALERTA[which].toString(); | |
// Aquí puedes mostrar la elección o hacer lo que sea con ella. | |
Toast.makeText(getActivity(), "Elegiste: " + eleccion, Toast.LENGTH_SHORT).show(); | |
// En el click se descarta el diálogo | |
dialog.dismiss(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment