/** creates location object by drawing variable fields from database */ private GeoTrackerLocation cursorToLocation(Cursor cursor) { GeoTrackerLocation location = new GeoTrackerLocation(); location.setId(cursor.getLong(0)); // the first index of the table is the id location.setLongitude(cursor.getString(1)); // the second index of the table is the longitude location.setLatitude(cursor.getString(2)); // the third index of the table is the latitude location.setDate(cursor.getString(3)); // the fourth index of the table is the date return location; } // cursorToLocation
/** deletes a row from database */ public void deleteLocation(GeoTrackerLocation location) { // id to figure out which location is going to be deleted long id = location.getId(); db.delete(dbHelper.TABLE_LOCATION, dbHelper.COLUMN_ID + " = " + id, null); } // deleteLocation