开发者

Making ItemizedOverlay onTap action trigger without user input to make a balloon visible when changing to screen activity

开发者 https://www.devze.com 2023-03-13 06:47 出处:网络
I have a MapView in my project where I display a set of items with ItemizedOverlay. When a user taps one of the items a balloon is displayed over it with some info.

I have a MapView in my project where I display a set of items with ItemizedOverlay.

When a user taps one of the items a balloon is displayed over it with some info.

Now, what I am trying to achieve is when changing to the map activity screen have a balloon show up without the user tap the screen...开发者_开发问答 like an initialization, where I make a balloon already visible without user input.


Maybe you can do this. While you are initially displaying the set of items on ItemizedOverlay, and as you identify the item that should show the balloon, run onTap method for that item's index. If items are already displayed, just identify or retrieve the index for item in question, and run onTap for it.


I did it using the following command:

itemizedoverlay.onTap(itemizedoverlay.getItem(0).getPoint(), mapView);

The object itemizedoverlay is an instance of my extension of ItemizedOverlay.


Have you tried to override onResume for your MapView? It will be called everytime your activity goes to foreground.

Hope it helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号