2
Googleマップビューにジオポイントを追加するとします。これは私のコードが次のようになります。Googleマップで遅延のあるジオポイントを追加する
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);
}
このコードは、すべてのポインタをmapViewに一度に入れています。地図上に各ポインタを置くときに少し遅れが出ます。 どうすればこのことができますか?事前に
おかげ
+1正解です。しかし、これらはクラス変数であり、グローバルではありません。グローバルは 'public'と' static'です。 – Stephan
真の相手、私が特定の分野で話しているので、私が意味するクラスのグローバル。 –
ありがとう、これは非常に有用だった –