Could someone advise me why I am only getting true result, even though that record does not exist in my database?
For clarification, in my table, _id is the telephone number.
Here's my code:
public boolean checkifExists(String number){
String[] columns = new String[]{"_id"};
String[] wehreargs = new String[]{number};
this.openDataBase();
if (myDataBase.query("mytable", columns, "_id=?", wehreargs, null, null, null)==null){
myDataBase.query("mytable", columns, "_id=?", wehreargs, null, null, null).close();
this.close();
return false;
} else {
myDataBase.query("mytable", columns, "_id=?", wehreargs, null, null, null).close();
this.close();
return true;
}
}