I have a Dialog that has an array of strings (name) and bools (checked or not)
external to the dialog selection I update the bools, The first click they are updated, after this they are no longer synced
OnCreateDialog only is called once. I tried dismissing the dialog by calling (d.dissmiss()) but I cant get it to sync.
Any Chance someone can help?
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;
}
}
}
This Answer stems from Luksprog comment of getting to the Listview of the Dialog
I changed the Dialog d variable to an AlertDialog and on my clearALL or SelectAll button calls I then manually iterate through the list and update the options – not the most efficient way of doing this, but the only way it seemed to work (his notifyonchange didnt do anything for me – I am confused why it wouldn’t…)