I use this nice library for showing balloons: MapViewBalloons
I want to add a toggle button into the baloon, so I can mark a point as a favorite. The problem is it switches the state of the whole overlay, not only of the current balloon.
How do I fix this? Here is my code, thanks in advance!
@Override
protected void setupView(Context context, final ViewGroup parent) {
// inflate our custom layout into parent
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.baloon_overlay, parent);
ToggleButton favorite = (ToggleButton) v
.findViewById(R.id.toggleButton1);
favorite.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
if (isFav==false) {
isFav=true;
System.out.println("true");}
else {
isFav=false;
System.out.println("false");
}
}
});
}