I am doing a Map application in Android using SQ开发者_Python百科Lite to store and retrieve data. So I create a table to store Latitude and Longtitude but I do not know how to retrieve the Latitude and Longtitude values from SQLite to bind them to Latitude and Longtitude values in the map activity.
Can anyone help me?
Use this as a start:
SQLiteDatabase db = openOrCreateDatabase("my_locations.db", SQLiteDatabase.CREATE_IF_NECESSARY, null);
String[] columns = new String[]{"latitude", "longitude"};
String[] name = new String[]{"DienTringh"};
Cursor c = db.query("location", columns, "name=?", name, null, null, null);
String latitude = c.getString(0);
String longitude = c.getString(1);
精彩评论