I'm calling a method to see if there is a value inside the database.
String[] columns ={table.NAME};
String[] selectionsArgs = {name};
Cursor cursor = db.query(table.TABLE_NAME, columns, table.NAME+"= ?", selectionsArgs,null, null, null, null);
int index = cursor.getColumnIndex(table.ID);
Irrespective of whether the name exists or not the index is always -1. Why ?