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 7522497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:32:24+00:00 2026-05-30T02:32:24+00:00

I am working on the an application in which I want to update contact

  • 0

I am working on the an application in which I want to update contact of particular person. When I update only contact first and last name then it working fine but I want to update full detail of contact like email address, number, postal addres etc.

Please provide me some useful link. Thanks in advance.

  • 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-05-30T02:32:25+00:00Added an answer on May 30, 2026 at 2:32 am

    each field (email, name, adress) has its on mime type, which you should use
    in order to update the field.

    lets try to update the email for instance.

    First, you should find the detail you want to update.
    we will work with Data table, where each Data.RAW_CONTACT_ID represents a detail
    about some contact.

    So, we need to find the Data.RAW_CONTACT_ID where the id is the id of the contact you want
    to edit.

    Now we need to find the mimetype (the specific row which represents the detail) of
    email (Email.CONTENT_ITEM_TYPE).

    The data of an email is stored in the column Email.DATA – there we put the new email.

    if you want a specific email type, you should add it to the query:
    for example, if you want to add a home-email, then you should add Email.TYPE_HOME
    to the query.

    then we build a query and finally apply the change.

    Here’s an examle:

        ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
    
        String emailParams = Data.RAW_CONTACT_ID + " = ? AND " + Data.MIMETYPE + " = ?";
        String[] emailParamsWhere = new String[] { "contact_id", Email.CONTENT_ITEM_TYPE };
    
        ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI).withSelection(emailParams, emailParamsWhere).withValue(Email.DATA, "new email").withValue(Email.TYPE, Email.TYPE_HOME) 
                .build());
    
        try
        {
            ContentProviderResult[] res = getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
    
            if (res != null)
            {
                return true;
            }
    
            return false;
        }
    
        catch (RemoteException e)
        {
            Log.d(TAG, e.getMessage());
            e.printStackTrace();
        }
    
        catch (OperationApplicationException e)
        {
            Log.d(TAG, e.getMessage());
            e.printStackTrace();
        }
    

    For updating mobile phone, use this query:

            String phoneParams = Data.RAW_CONTACT_ID + " = ? AND " + Data.MIMETYPE + " = ? AND " + Phone.TYPE + " = " + Phone.TYPE_MOBILE;
            String[] phoneParamsWhere = new String[] { "contact_id", Phone.CONTENT_ITEM_TYPE };
    
            ops.add(ContentProviderOperation.newUpdate(Data.CONTENT_URI).withSelection(phoneParams, phoneParamsWhere).withValue(Phone.NUMBER, "mobile_number")
                    .withValue(Phone.TYPE, Phone.TYPE_MOBILE).build());
    

    Hope I helped

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on an application which starts as a service but only if
I am trying to build an silverlight application which takes user first name, last
I am working on Alarm application in which I want to set Large Sound
I am working on an application which contain register activity as it's first page
I write a code to check an update for my application which is working
I'm working on an application which consists of many HorizontalScrollViews. Initially, everything was fine.
I am working on a data entry application which have only 3 tables with
I am working on application which needs to be authenticated in different domain. To
i am working on one application which requires the feature of adding the custom
I'm working on an application which allows employees to Request time off that post

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.