I want to check if records exist in the SQLite database, here\'s what I have done so far. when I search for a already existing records im getting value from EditText in list.
DatabaseManager.java
public Cursor checkFavourites()
{
String query="select * from "+DATABASE_TABLE;
Cursor cursor=db.rawQuery(query,null);
return cursor;
}
MainActivity.java
public void favourite_Click(View view){
Cursor cursor=dbManager.checkFavourites();
if (cursor.getCount()>0)
{
Toast.makeText(MainActivity.this, "Favourites", Toast.LENGTH_SHORT).show();
}
else
{
Toast.makeText(MainActivity.this,"Nothing in favourites yet", Toast.LENGTH_SHORT).show();
}
}