title: Unable to fetch deleted contacts from ContactsContract.Contacts.CONTENT_URI
body: <p>I am trying to fetch deleted contacts from Android contacts table. After searching some Stack Overflow links, best way to fetch the deleted contacts is by using <code>ContactsContract.DeletedContacts</code>. I am able to fetch the deleted contacts from DeletedContacts table.</p>
  <pre><code>val deletedContactsProjection = arrayOf(ContactsContract.DeletedContacts.CONTACT_ID,ContactsContract.DeletedContacts.CONTACT_DELETED_TIMESTAMP)
  val contactLastDeletedTimeStamp = SharedPreferenceManager.instance.getLongFromPreference(&quot;contact_sync_last_updated_timestamp&quot;)
  val deletedContactSelection = ContactsContract.DeletedContacts.CONTACT_DELETED_TIMESTAMP + &quot; &gt; ?&quot;;
  val deletedContactSelectionArgs = arrayOf&lt;String&gt;(contactLastDeletedTimeStamp.toString())
  var deletedContactsCursor = context.contentResolver.query(ContactsContract.DeletedContacts.CONTENT_URI, deletedContactsProjection,deletedContactSelection, deletedContactSelectionArgs,null)
  </code></pre>
  <p>Using the above cursor I'm able to fetch the last deleted contact. When I checked the ContactsContract.DeletedContacts.CONTACT_ID of the deleted contact from cursor, it's same as the contact id which I deleted. But the problem is when I'm trying to fetch the contact  from ContactsContract.Contacts table using the ContactsContract.DeletedContacts.CONTACT_ID its always returning null.</p>
  <p>This is the query I'm using:</p>
  <pre><code>String[] contactNumberProjection = {ContactsContract.Contacts._ID};
  String contactId = deletedContactsCursor.getString(deletedContactsCursor.getColumnIndex(ContactsContract.DeletedContacts.CONTACT_ID));
  String contactSelection = ContactsContract.Contacts._ID + &quot; = ?&quot;;
  String[] contactSelectionArg = {contactId};
  Cursor contactCursor =
  context.getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,contactNumberProjection,contactSelection,contactSelectionArg,null);
  </code></pre>
  <p>Where am I going wrong?</p>