I've got the following code which gets information from a database and plots it on a map. The information is there and clickable but the actual icon androidmarker
is not visable. Why? How do I fix this?
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tweets = new LocationData(this);
mapView = (MapView) findViewById(R.id.mapView);
mapView.setSatellite(true);
mc = mapView.getController();
mc.setZoom(17);
mapView.setBuiltInZoomControls(true);
// Add the MyPositionOverlay
positionOverlay = new MyPositionOverlay();
List<Overlay> overlays = mapView.getOverlays();
overlays.add(positionOverlay);
//Add the Mapitems Overlay.
mapOverlays = mapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker);
itemizedoverlay = new Mapitems(drawable, this);
mylocation();
distance(lat,lng);
addmark();
mapView.invalidate();
}
public void addmark(){
SQLiteDatabase db = tweets.getWritableDatabase();
String count = "SELECT * FROM tweets;";
Cursor mcursor = db.rawQuery(count, null);
startManagingCursor(mcursor);
mcursor.moveToFirst();
if(mcursor != null && mcursor.moveToFirst())
{
do
{
System.out.println("WHAT");
String tname = mcursor.getString(4);
String tmessage = mcursor.getString(7);
Double tlat = mcursor.getDouble(1);
System.out.println("lat" + tlat);
Double tlng = mcursor.getDouble(2);
System.out.println("lng" + tlng);
GeoPoint point = new GeoPoint(
(int) (tlat*1E6),
(int) (tlng*1E6));
OverlayItem overlayitem = new OverlayItem(point, tname, tmessage);
itemizedoverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedoverlay);
}while(mcursor.moveToNext());
}
}