I am using google maps therefore when checking the checkbox some pictures will be added to the layer and the other check box will add different layer... when unchecking the first check box the picture related to it will be removed and also for the same will happen for the second check box.. Now the problem is that when checking the first check box the pics are added and then i do uncheck to the related check box the pics are not removed while the second check box is working fine ?? Help please
I have a button that when I press it a dialog will be shown.. This dialog contains a check boxes. .
I defined the following variables in the class
CharSequence[] items = {"Layer1", "Layer2"};
boolean[] itemsChecked = new boolean[items.length];
in the On create method I defined the following
Button AddLayers = (Button) findViewById(R.id.addlayers) ;
AddLayers.setOnClickListener(this) ;
Then in the action
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(0);
}
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case 0:
return new AlertDialog.Builder(this)
//.setIcon(R.drawable.red_point)
.setTitle("Add Layer")
.setPositiveButton("OK", new DialogInterface.OnClickListener()
{
public void onClick(DialogInterface dialog, int id)
{
SparseBooleanArray CheCked = ((AlertDialog) dialog).getListView().getCheckedItemPositions();
if (CheCked.get(0))
{
...
mapOverlays.add(custom);
}
else {
mapOverlays.remove(custom);
}
if (CheCked.get(1))
{
......
mapOverlays.add(custom2);
}
else
{
mapOverlays.remove(custom2) ;
}
}