I want to loop through sqlite database if (johnny) is present in the database or not but my code is not working
if(!cursor.isAfterLast()) 
{
    do 
    {
        for(int i = 0; i<cursor.getCount(); i++)
        {
            if("johnny" == cursor.getString(1))
            { 
                Toast.makeText(getApplicationContext(), "string found!!! =)", Toast.LENGTH_LONG).show();
            }
        }                   
    } 
    while (cursor.moveToNext());
    }       
    cursor.close();
}
 
     
    