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();
} |
Partager