On my strings.xml I defined the following array and strings:
Using xml Syntax Highlighting
- <string name="titulo_pedir_tel">Ingresar número telefónico</string>
- <string name="accion_selecionar">Aceptar</string>
- <string name="accion_cancelar">Cancelar</string>
- <!-- Opciones del menu de envio -->
- <string-array name="select_dialog_items">
- <item>Enviar vía SMS</item>
- <item>Enviar vía email</item>
- </string-array>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4
and my single choice dialog is defined as it follows in my main.class
Using java Syntax Highlighting
- Builder builder = new AlertDialog.Builder(this);
- builder.setIcon(R.drawable.alert_dialog_icon);
- builder.setTitle(R.string.seleccionar_forma_envio);
- builder.setSingleChoiceItems(R.array.select_dialog_items, 0, new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int whichButton)
- {
- /* User clicked on a radio button do some stuff */
- }
- });
- builder.setPositiveButton(R.string.accion_selecionar, new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int whichButton)
- {
- /* User clicked Yes so do some stuff */
- }
- });
- builder.setNegativeButton(R.string.accion_cancelar, new DialogInterface.OnClickListener()
- {
- public void onClick(DialogInterface dialog, int whichButton)
- {
- /* User clicked No so do some stuff */
- }
- });
- builder.show();
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
The idea of this is that the user of my app selects a item of the array an base of the selection to realize some action. My problem is that I don't know how to recognize which item of the array the user selected. How can I solve my problem? Thanks in advance.
Regards,
Helios


