Question

I use BalloonItemizedOverlay.

I need method onHideBalloon.(I need to do some actions after hiding balloon.)
class BalloonItemizedOverlay has public void hideBalloon() {...}
Override it...?!

Was it helpful?

Solution

Looking at the class BalloonItemizedOverlay, you are correct: there is no onHideBalloon(), only an onBalloonOpen(). So, it seems that if you want to do any actions after hiding a balloon, you will simply need to perform those actions when you call hideBalloon(). Otherwise, what you can do, if allowed, is modify that class and add your own callback for onHideBalloon(). Having looked at the class, it doesn't seem like it would be too difficult.

You would basically modify the following in that class: Add this:

protected void onBalloonClose(int index) {}

And add that in whatever method closes the balloon:

public void hideBalloon() {
    if (balloonView != null) {
        balloonView.setVisibility(View.GONE);
        onBalloonClose(currentFocusedIndex);
    }
    currentFocusedItem = null;
}

Something like that.. might need to tweak it a bit, but I hope that can point you in the right direction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top