I'm getting a NullPointerException when I am trying to access the overlay text in on my AVD. It displays the overlay fine, but when I click on it, the program starts force closing.
Here is the onTap method where I tell it what to do when I click on the overlay:
Using java Syntax Highlighting
- @Override
- protected boolean onTap(int index)
- {
- OverlayItem item = mOverlays.get(index);
- AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
- dialog.setTitle(item.getTitle());
- dialog.setMessage(item.getSnippet());
- dialog.show();
- return true;
- }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
Here is where I first call it in my main activity:
Using java Syntax Highlighting
- //Add the overlay to the specified GeoPoint
- GeoPoint point = new GeoPoint ((int)(lat*1E6), (int) (lng*1E6));
- OverlayItem overlayitem = new OverlayItem(point,"Hello world","Ohai, this is where I am");
- itemizedoverlay.addOverlay(overlayitem);
- mapOverlays.add(itemizedoverlay);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
Any ideas would be greatly appreciated! Thanks again!
Here are the pastebins for the full code:
Main Acivity
ItimizedOverlay class


