Adding Overlay Items To Osmdroid-map In Asynctask
Solution 1:
Regarding the new items not showing in the ItemizedIconOverlay - what method are you using to add the items()? For some reason it looks like the addItem(location, item) method does not call populate() so the internal list never gets updated. Use the addItem(item) method for now. I should point out that ItemizedIconOverlay is a user-submitted class and is really just a starting point for a solution.
You mention having nulls in your item list. That is the way Java's ArrayList works. The list is backed by an immutable array so when the backing array is full and you want to add a new item, the list has to create a new larger backing array. Since that is an expensive operation, the new array will be double the size of the old one. The unused "slots" in the backing array are set to null. The only thing that matters is what is returned by mItemList.size().
Post a Comment for "Adding Overlay Items To Osmdroid-map In Asynctask"