title: android check if table is empty
body: <p>i working sqllite.i successfully created database and i can add/remove/update in my database
  now i want to write function to check if table is empty.if table is empty show Empty toast message else another toast message
  i wrote some code but awlays Toast message is empty
  this is a my code</p>
  
  <pre><code>public boolean checkForTables(){
      boolean hasTables = false;
      db = this.getWritableDatabase();
      Cursor cursor = db.rawQuery("SELECT * FROM " +TABLE_CONTACTS, null);
  
      if(cursor.getCount() == 0){
          hasTables=false;
      if(cursor.getCount() &gt; 0){
          hasTables=true;
      }
  
      cursor.close();
      }
      return hasTables;
  
  
  }
  </code></pre>
  
  <p>and i check this function in another activity,but as i said always toas message is Empty</p>
  
  <pre><code>if(helper.checkForTables())
          Toast.makeText(getActivity(), "not empty", Toast.LENGTH_SHORT).show();
  
      else
          Toast.makeText(getActivity(), "empty", Toast.LENGTH_SHORT).show();
  </code></pre>
  
  <p>what am i doing wrong if anyone knows solution please help me</p>