If you want to create a dialog which will look like as spinner dialog of single choice in android which will open in button click event than you can create a custom dialog.
Sample code given below :-
You just have to call this method on click event.
public void showDialog() {
CharSequence[] items = {"Red","Green","Blue" };
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setSingleChoiceItems(items, 0,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}
});
alert = builder.create();
alert.show();
}
0 Comment(s)