我有一个对话框,它有一个字符串数组(名称)和布尔值(选中与否)
在对话框选择之外我更新布尔值,第一次单击它们会更新,之后它们不再同步
OnCreateDialog 只被调用一次。我尝试通过调用 (d.dissmiss()) 来关闭对话框,但我无法让它同步。
有人可以提供帮助吗?
protected String[] _Geooptions;
protected boolean[] _Geoselections;
Dialog d;
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case 0:
d = new AlertDialog.Builder(this)
.setTitle("Set Geo Filters")
.setMultiChoiceItems(mapGeoManager._Geooptions,
mapGeoManager._Geoselections,
new GeoDialogSelectionClickHandler())
.setPositiveButton("OK", new GeoDialogButtonClickHandler())
.create();
return d;}
public class GeoDialogSelectionClickHandler implements
DialogInterface.OnMultiChoiceClickListener {
public void onClick(DialogInterface dialog, int clicked,
boolean selected) {
Log.i("ME", mapGeoManager._Geooptions[clicked] + " selected: "
+ selected);
mapGeoManager.FilterUpdate();
}
}
public class GeoDialogButtonClickHandler implements
DialogInterface.OnClickListener {
public void onClick(DialogInterface dialog, int clicked) {
switch (clicked) {
case DialogInterface.BUTTON_POSITIVE:
Log.d(TAG, "ON CLICK BUTTON POSITIVE!");
mapGeoManager.FilterUpdate();
break;
}
}
}