0
如何从一个AlertDialog获取AlertDialog选择项目
AlertDialog.Builder b = new AlertDialog.Builder(SettingsCustom.this);
b.setTitle("Example");
String[] types = {"Item 1","Item 2","Item 3" };
b.setItems(types, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int which) {
dialogInterface.dismiss();
//How to get the selected text
}
});
b.show();
是的,这是唯一的方法。 OnClickListener是**旨在**获取'which'并进一步使用它 – sberezin 2015-02-06 11:57:19