2012年1月9日 星期一

ItemizedOverlay Occur NullPointerException When Touch / Tap A MapView

參考:http://timpner.com/computing/android-nullpointerexception-when-scrolling-through-a-mapview-w-itemizedoverlay/

簡單說就是兩點要注意:
在ItemizedOverlay的constructor
1. 用 boundCenter(drawable) 或是 boundCenterBottom(drawable) 給地圖上的Marker有Bound。
2. 馬上populate()

這樣就不會在MapView.onTouchEvent的時候出現Exception。

沒有留言:

張貼留言