I wrote some code which implements the listView inside alertDialog. now when i want to implement some function on the listview I didnt succeed doing it. here is the code to he alertDialog:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select Name");
ListView modeList = new ListView(this);
String[] stringArray = new String[] {"red" , "green" , "blue"};
ArrayAdapter<String> modeAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, stringArray);
modeList.setAdapter(modeAdapter);
builder.setView(modeList);
final Dialog dialog = builder.create();
dialog.show();
how can i implement a function on a clicked item?