0

I have store the Latitude and Longitude of locations in a SQLite Database, how would I retrieve these values and place them each in an OverlayItem class for use in Google's Map code? i got this question with answer [1]: Get Latitude and Longitude from SQLite database for use in Android MapOverlay this is really helpful but im new in android unable to understand many things e.g where i should perform this action, in class that is extends MapActivity or in ItemizedOverlay please would anyone explain it step by step it will be highly helpful for all learners. thanks.

Community
  • 1
  • 1
Deverloper
  • 37
  • 2
  • 6

1 Answers1

0

You want to implement ItemizedOverlay within the MapActivity class. see example.

public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.drawable.navup);      

        MapView mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);

// Get your GeoPoints from SQLLite and use them below for Longitude and Latitude

GeoPoint point1 = new GeoPoint(latitude,longitude); 
OverlayItem overlayitem1 = new OverlayItem(point1, "City", "State");
List<Overlay> mapOverlays1 = mapView.getOverlays();
Drawable drawable1 = this.getResources().getDrawable(R.drawable.map_pin);
ClevelItemizedOverlay itemizedoverlay1 = new ClevelItemizedOverlay(drawable1, this);
apesa
  • 12,163
  • 6
  • 38
  • 43