title: how to compare the text field values with database values which is entered in the text field
body: <p>Actually, I don't want to accept the same name which is already entered in the text field (i.e; unique values) stored in database. </p>
  
  <p>For example, I entered a name "health" in text field and saved it. If again enter the same name then it won't accept.</p>
  
  <p>I tried below but it's not working. Please help me.</p>
  
  <pre><code>boolean ifExisting(String cat)
       {
        Cursor c = db.rawQuery("SELECT * FROM " + "restaurants" + "WHERE" + "category" + "=" + cat, null); 
           if(c.getCount() == 0)
           {
            return; 
           } 
            else
            {
             return;
            }
       }
         insert();
  </code></pre>