Bonjour
Je voudrais afficher un AlertDialog personnalisé à partir d'un clic sur un item d'un listview, j'ai donc créé un custom_dialog.xml
je récupère le string nom de l'item
Ensuite je créé une procédure FicheDialog()
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 @Override protected void onListItemClick(ListView l, View v, int position, long id) { Cursor cursor=(Cursor)l.getAdapter().getItem(position); String nom=cursor.getString(cursor.getColumnIndex("nom")); FicheDialog(); super.onListItemClick(l, v, position, id); }
Je n'arrive pas a écrire le code pour afficher le String nom dans la textview text de mon layout.custom_dialog.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 public void FicheDialog(){ AlertDialog.Builder ad = new AlertDialog.Builder(this); ad.setTitle("Bonjour"); ad.setView(LayoutInflater.from(this).inflate(R.layout.custom_dialog, null)); ad.show(); }
Ce que souhaierais c'est à partir du String nom, c'est créer un databind pour afficher plusieurs infos sur mon layout.custom_dialog
Pouvez-vous me guider ?
Merci pour vosréponses
JCM
Partager