title: How to get group name from a known contact
body: <p>I am trying to get the group name from a contact name based on a string. I thought this would be a more common question but every answer I have seen on google or here is outdated, has no answers or is incorrectly answered by explaining everything about groups except what the actual question ask. Once again, how do you get the group name of a contact where you already know the contacts name? </p>
  
  <pre><code>Cursor phones = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null,null,null, null);
  while (phones.moveToNext()) {
      String contactname=phones.getString(phones.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
      String contactgroup =  "GET GROUP NAME FROM STRING"(contactname);     
  }
  
  phones.close();
  </code></pre>