I have the following piece of code, which is behaving in a very strange manner.
1. When I run this code, the Cursor always carries 0 rows. 2. I know this sounds stupid, but when I debug the code, it carries all the rows in my table. 3. Alternatively, when I do not close the database and run through it, it carries all the rows. Is this a timing issue of some sort? Has it anything to do with the cursor's lifetime? Will the cursor be invalid if I close the database and the openlitehelper? Why in that case do I get valid data if I debug through the code. //Open the database openForRead(); StringBuilder query = new StringBuilder("SELECT "); //Append the projection columns SQLiteQueryBuilder.appendColumns(query, projection); //Force append the _ID column SQLiteQueryBuilder.appendColumns(query, new String[]{", " + _IDColumnName + " AS " + BaseColumns._ID}); //From tablename query.append("FROM " + tableName); //Query the database and return the cursor C = database.rawQuery(query.toString(), null); //Close the database close(); return C; -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en