I\'ve implemented PopupMenu for a menu that is displayed after pressing an item on the ActionBar. I am wondering what alternatives there are for SDK versions before 11?
As @sastraxi suggested, a good solution is using an AlertDialog with CHOICE_MODE_SINGLE.
AlertDialog.Builder builder = new AlertDialog.Builder(MyAndroidAppActivity.this);
builder.setTitle("Pick color");
builder.setItems(R.array.colors, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// The 'which' argument contains the index position
// of the selected item
}
});
builder.setInverseBackgroundForced(true);
builder.create();
builder.show();
And the strings.xml file.
- blue
- white
Reference: Adding a List