I have a spinner widget in my activity which lets users pick a list name.
Normally, the function of the spinner is to switch between lists but for a couple of instances,
CharSequence[] items = {"Mangoes", "Bananas", "Grapes"};
new AlertDialog.Builder(getActivity())
.setTitle("Action")
.setItems(items, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int item) {
if(item==0){
// Mangoes selected
}
else if(item==1){
// Bananas selected
}
else if(item==2){
// Grapes selected
}
}
})
.show();