setSingleChoiceItems avec connexion BDD
bonjour,
j'ai fait une alerte ou j'affiche une liste de nom et prénom (d'une BDD),
j'ai fait un setSingleChoiceItems pour avoir des radio bouton mais rien, pas de radio bouton.
a défaut j'aimerai au moins récupérer le nom quand je clique sur un !
mais je ne sais pas quel variable allé cherché !
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| public void BoiteAlert(){
AlertDialog.Builder ba = new AlertDialog.Builder(this);
ba.setTitle("Choisir une personne");
Cursor c = db.recupererListePersonnels();
startManagingCursor(c);
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,R.layout.list_item,
c,new String[]{"nom","prenom"},new int[]{R.id.textNom,R.id.textPrenom});
ba.setSingleChoiceItems(adapter, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface arg0, int arg1) {
Nom.setText(R.id.textNom);
}
});
ba.setPositiveButton("Ok", new android.content.DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Nom.setText("bla");
}
});
ba.setNegativeButton("Annuler", new android.content.DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//ok;
}
});
ba.show();
} |
soit au clique dessus ou sur le bouton ok. je veux l'afficher apres dans un textview (ou autre, je sais pas encore trop hihi) !
merci de votre aide car pour le moment je bricole plus que je code :calim2: