android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 0
while placing debugger in the the method it is not going after the line
double lans = c.getDouble(c.getColumnIndex(LAN));
double lons = c.getDouble(c.getColumnIndex(LON));
Can any one help me to solve it
public Locationxy getData(int id , DataBaseHelper dbHelper ) {
SQLiteDatabase dbo = dbHelper.getReadableDatabase();
Locationxy locationxy=new Locationxy();
String[] coulmns = new String[]{BumpID, LAN, LON};
String[] args = new String[]{String.valueOf(id)};
Cursor c = dbo.query(TABLE_BUMPS, coulmns, BumpID + "=?",args, null, null, null, null);
if ((c !=null ) && c.getCount()>0 )
c.moveToFirst();
double lans = c.getDouble(c.getColumnIndex(LAN));
double lons = c.getDouble(c.getColumnIndex(LON));
locationxy = new Locationxy(lans, lons);
return locationxy ;
} }
Aucun commentaire:
Enregistrer un commentaire