I have the following code, the first cursor object works fine, but when i do another query and assign it to the flightCursor, it gives the error.
Cursor curs
Close your cursor when you're done with it! I think you've just got too many cursor objects open
Cursor cursor = database.query( CityAndAirportsTable.notificationsTable, new String[] { CityAndAirportsTable.notifyFlightId },
null, null, null, null, "Id DESC" );
cursor.moveToFirst();
while( !cursor.isAfterLast() ){
String id = String.valueOf( cursor.getInt( 0 ) );
Cursor flightCursor = database.query(
CityAndAirportsTable.flightTable,
new String[] { CityAndAirportsTable.fromDestinationCode,
CityAndAirportsTable.toDestinationCode,
CityAndAirportsTable.currentPrice },
CityAndAirportsTable.flightId + "=" + id,
null, null, null, null );
/* Close the cursor here! */
flightCursor.close();
/* ---------------------- */
}
Hopefully this fixes your issue