How do I get all the details of a contact in a specific group, Android?
<p>I am trying to get all details of one group (for example - family).</p>

<p>The code:</p>

<pre><code>Cursor c = managedQuery(Data.CONTENT_URI, new String[] {
            Contacts.DISPLAY_NAME, Contacts._ID,GroupMembership.CONTACT_ID },
            GroupMembership.GROUP_ROW_ID + " = ?",
            new String[] { groupID }, Phone.TIMES_CONTACTED + " DESC");
</code></pre>

<p>Get name and photo:</p>

<pre><code>while (c.moveToNext()&amp;&amp;temp_id&lt;30)
        {           
            String id = c.getString(personIdx);

            //c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
            Log.e("myTag", id); 

            // get name
            try{
                personNameText = c.getString(c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));

            }catch (Exception e) {
                e.printStackTrace();
            }
            // get photo
            try{
                bmp = loadContactPhoto(getContentResolver(),Long.parseLong( id));
                bmp = bmp.createScaledBitmap(bmp, getResources().getDrawable(R.drawable.contact).getIntrinsicWidth(),
                        getResources().getDrawable(R.drawable.contact).getIntrinsicHeight(), false);

            }catch (Exception e) {
                // TODO: handle exception
            }

            // get number and email
            try
            {
                String hasPhone = c.getString(c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));

                if ( hasPhone.equalsIgnoreCase("1"))
                    hasPhone = "true";
                else
                    hasPhone = "false" ;

                if (Boolean.parseBoolean(hasPhone)) 
                {   

                    getNumbers(id);
                }
            }catch (Exception e) {
                e.printStackTrace();
            }

            // get email
            String email = "";
            try{
                Cursor emailCur = getContentResolver().query( 
                        ContactsContract.CommonDataKinds.Email.CONTENT_URI, 
                        null,
                        ContactsContract.CommonDataKinds.Email.CONTACT_ID + " = ?", 
                        new String[]{id}, null); 

                while (emailCur.moveToNext()) { 
                    email = emailCur.getString(
                            emailCur.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
                } 
                emailCur.close();


            }catch (Exception e) {
                e.printStackTrace();
            }
</code></pre>

<p>insert to database</p>

<pre><code>temp_id++;

                insertData(temp_id, bitmaptoByteArray(bmp), phoneNamberText, personNameText,
                        email);
</code></pre>

<p>All functions mentioned here work very well!
The problem is that I get only the names of people and not the other details.
I think the problem is I get mistaken id.
I would appreciate help!!!</p>
