I am looking to the fastest and the correct way to check if a record exists in the database:
public boolean Exists(String _id) {
Cursor c=db.query(TABLENAME(), new String[] {"1"}, "_ID="+_id, null, null, null, null);
if (!c.equals(null))
return c.moveToFirst();
return false;
}
Do you see any problem with it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…