TsCyrille Posted August 25, 2010 Share Posted August 25, 2010 Bonjour J'ai défini un layout contenant une ListView. Je veux afficher ce layout dans une AlertDialog. Pour cela je fais ceci : public void onClick(View v) { AlertDialog.Builder alertdialog = new AlertDialog.Builder(this); alertdialog.setView(LayoutInflater.from(this).inflate(R.layout.mon_layout, null)); alertdialog.show(); Ma question est la suivante : comment affecter l'adapter et l'évènement setOnItemLongClickListener a la ListView (avec en plus appel de l'alertdialog dans l'évènement pour fermer cette dernière) ? Merci d'avance Link to comment Share on other sites More sharing options...
Fluckysan Posted August 25, 2010 Share Posted August 25, 2010 Tu peux faire comme sur un Activity lorsque tu inflate ton XML : View alertView = LayoutInflater.from(this).inflate(R.layout.mon_layout, null); ListView alertListView = (ListView) alertView.findViewById(R.id.AlertListView); AlertViewAdapter adapter = new AlertViewAdapter(); alertListView.setAdapter(adapter, ...); ... Link to comment Share on other sites More sharing options...
TsCyrille Posted August 25, 2010 Author Share Posted August 25, 2010 Merci pour ton aide Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.