i have problem to retrieve data from database using this method getData()
DataBase Class
public void getData(int id) {
SQLiteDatabase db = this.getReadableDatabase();
String[] coulmns = new String[]{BumpID, LAN, LON};
Cursor c = db.query(BumpsTable, coulmns, BumpID + "=?", new String[]{String.valueOf(id)}, null, null, null, null);
if (c != null)
c.moveToFirst();
// ArrayList<String> array =new ArrayList<String>();
Locationxy locationxy = new Locationxy();
locationxy.setId(c.getString(0));
locationxy.setLan(c.getString(1));
locationxy.setLon(c.getString(2));
Log.i(c.getString(1), c.getString(2));
array.add(c.getString(0));
array.add(c.getString(1));
array.add(c.getString(2));
}
MapClass
or(int i=0 ;i<=5 ;i++) {
if(db!=null) {
db.getData(i);
locationB.setLatitude(Double.parseDouble(locationxy.getLan()));
locationB.setLongitude(Double.parseDouble(locationxy.getLon()));}}
getData() method makes error , and leave application
Aucun commentaire:
Enregistrer un commentaire