while am trying to pick a contact from phone book it is returning another contact... i dont know what happening.. this is my code....
.//*contactData is uri getting from onActivity result* *String[] parts = contactData.toString().split("/"); long id = Long.parseLong(parts[parts.length - 1]); Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, id); Uri entityUri = Uri.withAppendedPath(rawContactUri, Entity.CONTENT_DIRECTORY); Cursor c = activity .managedQuery( entityUri, new String[] { Entity.MIMETYPE, Entity.DATA1, Phone.TYPE }, Entity.MIMETYPE + "=? OR " + Entity.MIMETYPE + "=?", new String[] { ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE }, null); String NumbersData[][] = new String[c.getCount() - 1][2]; number_type = new String[c.getCount() - 1]; if (c.moveToFirst()) { do { String mimeType = c.getString(0); if (mimeType .equals(ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)) { NAME = c.getString(1); Log.d(TAG, "Name: " + NumbersData); } else if (mimeType .equals(ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE)) { NumbersData[i][0] = c.getString(2); // this is number type NumbersData[i][1] = c.getString(1); //this is the number i++; Log.d(TAG, "Phone: " + NumbersData); } } while (c.moveToNext());* -- A N K ! T...... -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en