Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8011195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:57:29+00:00 2026-06-04T18:57:29+00:00

I am developing an application where, I have to add phone no, email, website,

  • 0

I am developing an application where, I have to add phone no, email, website, address etc. to my existing contact on a click of a button.

the function on the click of the button goes here

private void updateContact(String name) 
   {
Log.d(TAG, "in updatecontact()");
Log.d(TAG,"Contact name to be updated = "+name);
ContentResolver cr = getContentResolver();
     String where = ContactsContract.Data.DISPLAY_NAME + " = ? AND " + 
            ContactsContract.Data.MIMETYPE + " = ? AND " +
            String.valueOf(ContactsContract.CommonDataKinds.Phone.TYPE) + " = ? ";
String[] params = new String[] {name,
        ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE,
        String.valueOf(ContactsContract.CommonDataKinds.Phone.TYPE_HOME)};

Cursor phoneCur = managedQuery(ContactsContract.Data.CONTENT_URI, null, where, params, null);

ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();

if ( (phoneCur == null)  ) {
    add_new_contact();
} else {
    // Phone no
    ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
            .withSelection(where, params)
            .withValue(ContactsContract.CommonDataKinds.Phone.DATA, Tel)
            .build());
    // Email
    ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
            .withSelection(where, params)
            .withValue(ContactsContract.CommonDataKinds.Email.DATA, Email)
            .build());
    // Website
    ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
            .withSelection(where, params)
            .withValue(ContactsContract.CommonDataKinds.Website.DATA, Url)
            .build());
    //Organization
    ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
            .withSelection(where, params)
            .withValue(ContactsContract.CommonDataKinds.Organization.DATA, Org)
            .build());
}

phoneCur.close();

try {
    cr.applyBatch(ContactsContract.AUTHORITY, ops);
} catch (RemoteException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (OperationApplicationException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}}}

I am unable to update my contact.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T18:57:30+00:00Added an answer on June 4, 2026 at 6:57 pm

    i am assuming that you do not know how to do that, and that is your question.

    this may help

    ContentResolver cResolver = context.getContentResolver();
    public void AddToContact()
    {
        insertContentValues(cResolver, Contacts.Phones.CONTENT_URI, getPhoneCV(phone));
    }
    
    public ContentValues getPhoneCV(RowData data) {
            ContentValues cv = new ContentValues();
    
            String PhoneNumber = "055434553";
            cv.put(Contacts.Phones.NUMBER,PhoneNumber );
            return cv;
        }
    
    private Uri insertContentValues(ContentResolver cResolver, Uri uri, ContentValues cv) {
            if (cv != null) {
              return cResolver.insert(uri, cv);
            }
            return null;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing my first Windows Phone 7 application and I have to add an
I am developing an application which requires to add Calendar event. I have written
I have following situation: I'm developing an address-application to store the details of our
I'm developing a Windows Phone application. I have defined a ListBox.ItemTemplate's DataTemplate as follows:
I'm developing a twitter application for Windows Phone 7 and have been doing some
I am developing window phone 7 application. I have a listbox in my application.
I'm developing a Windows Phone 7.1 application. I have the following folders structure: -
HI Im currently developing an application where i have to add the text over
I am developing an android database application in which i have to add multiple
I have developend a window application(Win32 API) in visual C++. I have to add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.