private GeoPoint getLocation(String str) throws IOException { int lat,lon; coder = new Geocoder(this, Locale.getDefault()); List<Address> list = coder.getFromLocationName(str, 1); if((list!=null)&&(list.size()>0)) { Address a = list.get(0); lat = (int)(a.getLatitude()*1e6); lon = (int)(a.getLongitude()*1e6); } else { lat = (int)(22.55*1e6); lon = (int)(114.1*1e6); }
return new GeoPoint(lat, lon); }
class MyOverlayItem extends ItemizedOverlay<OverlayItem> { private List<OverlayItem> list = new ArrayList<OverlayItem>(); public MyOverlayItem(Drawable defaultMarker) { super(defaultMarker); // TODO Auto-generated constructor stub }
public void additem(OverlayItem item) { list.add(item); populate(); }