I want to check whether a row of the sqlite table exists in database or not..If row exists i should call a class otherwise another class.To get this functionality i am using
public boolean Exists(int position) {
SQLiteDatabase db = (placeData).getReadableDatabase();
Cursor cursor = db.rawQuery("select * from pages where bbookid ='"+ position +"'", null);
boolean exists = (cursor.getColumnName(position)) != null;
Log.i("logs","fads");
if(exists=true)
{
getDataAndPopulate();
}
else
{
Log.i("qefw","cursors");
new LoadAllProducts().execute();
}
cursor.close();
return exists;
}
but using this code the rows are reinserting ..Could anyone suggest me the way to approach the functionality