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