Add organization details in contact list
        Posted  
        
            by Nemat
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Nemat
        
        
        
        Published on 2010-06-10T09:21:16Z
        Indexed on 
            2010/06/10
            9:22 UTC
        
        
        Read the original article
        Hit count: 308
        
android
|android-sdk
Hi Friends.....
I have to add organization details in contacts.Here is my code:
Uri newPersonUri = null; ContentValues personValues = new ContentValues(); // Add name and get its Uri personValues.put(People.NAME, arrValues[0] + " " + arrValues[1]); personValues.put(People.STARRED, 0); // STARRED 0 = Contacts, 1 = Favorites personValues.put(People.NOTES, arrValues[9]); //add notes newPersonUri = context.getContentResolver().insert(android.provider.Contacts.People.CONTENT_URI, personValues);
ContentValues organisationValues = new ContentValues(); Uri orgUri = Uri.withAppendedPath(newPersonUri, android.provider.Contacts.Organizations.CONTENT_DIRECTORY);
        //Uri orgUri =Uri.withAppendedPath(newPersonUri, "organizations"); 
        organisationValues.clear();
        organisationValues.put(Organizations.COMPANY, arrValues[10]);
        organisationValues.put(Organizations.TITLE, arrValues[11]);
        organisationValues.put(Organizations.TYPE, Organizations.TYPE_WORK);
        objContext.getContentResolver().insert(orgUri, organisationValues);
It works fine in some phones but in some phones it gives "java.lang.UnsupportedOperationException: Unknown uri: content://contacts/people/201/organizations"
What can be the reason.....
Any help will be appreciated!!!!
Thanks in Advance Nemat
© Stack Overflow or respective owner