I have this problem in getting my cursor return my query with a selection String.
Below is the sample structure of the cursor :
String T_NAME = "tableName";
String T_ID = "idTable";
String C_FIRST = "first";
String C_SECOND = "second";
Cursor cursor = database.query(T_NAME, null, C_FIRST + " = ? AND " + C_SECOND + " = ?", new String[] { String.valueOf(firstArr), String.valueOf(secondArr) } , null, null, T_ID);
When I check the cursor.getCount() it return 0 but when check the table using SQLite Database Browser and with the SQL command below it return the proper data.
SELECT * FROM tableName WHERE first = 0 AND second = 0
What could be the cause of error and how can I resolve it?
Thanks in advance.
Your code looks fine to me. Are you sure the SQLite database you are querying with SQLite Database Browser is the same one that is being accessed by your application?
Use an adb remote shell to connect to the database file on the device directly and issue your select query there. Example: