title: get a single row from table
body: <p>These are the ids in my table:</p>
  
  <pre><code>KEY_ID(autoincremented integer primary key)   KEY_NAME(text)     KEY_PH_NO(text)
  
  1                                             james                   1234567890
  2                                             kristein                6484996755
  3                                             Roen                    4668798989
  4                                             Ashlie                  6897980909
  </code></pre>
  
  <p>What I want to know is, how can I get a single record from this table on the basis of <code>unique(KEY_ID)</code>, for this i have built a <code>getContact()</code> method like this,</p>
  
  <pre><code>Contact getContact(int id) {
      SQLiteDatabase db = this.getReadableDatabase();
  
      Cursor cursor = db.query(TABLE_CONTACTS, new String[] { KEY_ID,
              KEY_NAME, KEY_PH_NO }, KEY_ID + "=?",
              new String[] { String.valueOf(id) }, null, null, null, null);
      if (cursor != null)
          cursor.moveToFirst();
  
      Contact contact = new Contact(Integer.parseInt(cursor.getString(0)),
              cursor.getString(1), cursor.getString(2));
      // return contact
      return contact;
  }
  </code></pre>
  
  <p>And <code>Contact</code> is a class where I have set all the getter and setter method for all attributes.</p>
  
  <p>Please help with complete code.</p>