I want to create custom AlertDialog, but without AlertDialog.Builder. I set ListView as content view and wish to set DialogInterface.OnClickListener on its items.
Here is method onCreate() of my custom MyAlertDialog extends AlertDialog.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Context context = getContext();
setTitle("Custom title");
ListView listView = new ListView(context);
listView.setAdapter(new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, new String[] { "One", "Two" }));
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
setContentView(listView);
}
I had read docs about DialogInterface, Dialog and AlertDialog many times, but I didn't find the option like "AlertDialog.setOnClickListener()".
The solution must be without AlertDialog.Builder.
OnItemClickListener? - Sherif elKhatib