What I want to do is adding GeoPoints on a google mapView. This is what my code now looks like:
public ArrayList getLocations() {
ArrayList<OverlayItem> locations = new ArrayList<OverlayItem>();
/* open SQLite database aanmaken als deze al dan niet bestaat */
SQLiteDatabase myDB = openOrCreateDatabase(DATABASE_NAME, Context.MODE_PRIVATE, null);
SharedPreferences preferences = getSharedPreferences("data", 0);
String route_id = String.valueOf( preferences.getInt("route_id", 0));
String[] resultColumns = new String[] { "_id", "route_id","naam", "lng", "lat" };
String whereClause = "route_id=?";
String[] whereArgs = new String[] {route_id};
Cursor cursor = myDB.query(DATABASE_TABLE_LOCATIES, resultColumns, whereClause,
whereArgs, null, null, null, null);
cursor.moveToFirst();
do {
String naam = cursor.getString(2);
Double lat = cursor.getDouble(4);
Double lon = cursor.getDouble(3);
GeoPoint point = new GeoPoint((int) (lat * 1E6),(int) (lon * 1E6));
locations.add(new OverlayItem(point, naam,naam));
} while (cursor.moveToNext());
return locations;
}
public void onCreate(Bundle savedInstanceState) {
InterestingLocations funPlaces = new InterestingLocations(marker);
mapView.getOverlays().add(getLocations);
}
This code is putting all my pointers at once on the mapView. I would like a small delay when putting each pointer on the map.
How could I do this?
Thanks in advance
First define global variable,
add this inside
onCreate()method:and add this function in the class:
and define this as global variable: