NullPointerException in ItemizedOverlay.getIndexToDraw

可紊 提交于 2019-12-03 23:49:05

I do not see where you are calling populate() on your CampsOverlay.

Here is a sample project showing asynchronous loading of overlay items -- perhaps it will give you some ideas, if populate() is not the issue.

He is correct. You must call populate() to populate the overlay. You may want to create all the overlay items in the constructor, call populate, and in createItem just return the item from a list.

"Now I just have to figure out why the overlay items aren't appearing"

In case you didn't, it's because you have to use a static function on your Drawable that will explain how is your marker positioned.

You can use this, in your CampsOverlay constructor:

super(boundCenter(defaultMarker));

This will indicate that the origin of your Drawable is the center. You can also use boundCenterBottom() to indicate that the origin is the bottom center of the Drawable.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!