I have 3 list within my list dialog but I want each item to do something different when it is clicked. How can I achieve this? I know the code needs to go in the onClick method, but I don't what needs to do so.
final CharSequence[] items = { "Item 1", "Item 2", "Item 3"};
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Title");
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
}
}).show();
Aucun commentaire:
Enregistrer un commentaire