I'm using this code to get the count from the cursor. On executing the Select query in SQLite Manager I am getting count as 6.
public int getCount(String name){
Cursor cursor;
cursor = myDataBase.rawQuery(
"select count(*) as _count from tProviderNode where parentId IN(select identifier from tProviderNode where name='"
+ name + "');", null);
return cursor.getInt(cursor.getColumnIndex("_count"));
}
On execution of this function I'm getting the following error:-
android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
Why I'm getting this error? Am I missing anything.