Show marker/geopoint with existing sqlite database
Anyone, please help me..
When i try to add location by long and lat on the source code, it's work.
But
when i tried to add location by existing database, i got force close.
here my source code :
private void initLokasi() {
SQLiteDatabase db;
db = openOrCreateDatabase(
"imsyakiyah.db"
, SQL开发者_开发百科iteDatabase.CREATE_IF_NECESSARY
, null
);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
Cursor cur = db.query("masjidmap",
null, null, null, null, null, null);
cur.moveToFirst();
while (cur.isAfterLast() == false) {
String nama_masjid = cur.getString(1);
int latitude = cur.getColumnIndex("latitude");
int longitude = cur.getColumnIndex("longitude");
list_lokasi.add(new Lokasi(longitude,latitude, 1,nama_masjid));
cur.moveToNext();
}
cur.close();
}
What should i do?
Thanks
REPLACE
int latitude = cur.getColumnIndex("latitude");
int longitude = cur.getColumnIndex("longitude");
WITH
int latitude = cur.getInt(cur.getColumnIndex("latitude"));
int longitude = cur.getInt(cur.getColumnIndex("longitude"));
精彩评论