title: Android sqlite: how to retrieve specific data from particular column?
body: <p>I am developing restaurant menu application. My app has a sqlite table which has these columns:</p>
  
  <pre><code>"id", "category", "item_name"
  </code></pre>
  
  <p>Contents of category column is of type string. Primary key of table is <code>id</code>. </p>
  
  <p>I want to retrieve data of particular category.</p>
  
  <p>For example, I want to retrieve item names of all items which are in category <code>Veg</code> and then display this result in list view. </p>
  
  <p>I have tried following different queries but both are not working. Please help me.</p>
  
  <pre><code>String vg ="Veg";
  Cursor mCursor = database.query(true, DATABASE_TABLE, new String[] {
             KEY_ROWID, KEY_CATEGORY, KEY_NAME,KEY_PRIZE,KEY_DESCRIPTION },
          KEY_CATEGORY + "=" + vg , null, null, null,null, null);
          if (mCursor != null) {              
                          mCursor.moveToFirst();
          }
          return mCursor;
  </code></pre>
  
  <p>Raw query</p>
  
  <pre><code>String query = "SELECT * FROM todo WHERE category =" + vg ;
            Cursor  cursor = database.rawQuery(query,null);
              if (cursor != null) {
                  cursor.moveToFirst();
              }
              return cursor;
  </code></pre>