Not too sure whats going on. I'm trying to geocode a location in a 2d array. It always throws this java.lang.NullPointerException exception. This is my code.
private class SitesOverlay extends ItemizedOverlay<OverlayItem> { private List<OverlayItem> items=new ArrayList<OverlayItem>(); private Drawable marker=null; private Geocoder gc; private List<Address> foundAdd; private String[][] locations = {{"home","nairobi"},{"james","Ngara"}, {"pangani","pangani"}}; public SitesOverlay(Drawable marker) { super(marker); this.marker=marker; try{ for( int i =0; i < locations.length; i++ ) { foundAdd = gc.getFromLocationName( locations[i][1]+",kenya", 5); for( int w =0; w < foundAdd.size(); w++ ) { Address address = foundAdd.get(i); lat = address.getLatitude(); lon = address.getLongitude(); latitude = (lat * 1000000); longitude = ( lon * 1000000 ); items.add(new OverlayItem(new GeoPoint( latitude.intValue() , longitude.intValue()), locations[i][0],locations[i][1]+"\n")); } } }catch(Exception e) { Log.i("Address not found ", e.toString()); } populate(); } @Override protected OverlayItem createItem(int i) { return(items.get(i)); } //draw marker on the map @Override public void draw(Canvas canvas, MapView mapView, boolean shadow) { super.draw(canvas, mapView, shadow); boundCenterBottom(marker); } @Override protected boolean onTap(int i) { Toast.makeText(this, items.get(i).getSnippet(), Toast.LENGTH_SHORT).show(); return(true); } @Override public int size() { return(items.size()); } } --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---