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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:34:05+00:00 2026-06-06T19:34:05+00:00

iam adding a contact to the device using this code long Contact_Id = 100;

  • 0

iam adding a contact to the device using this code

long Contact_Id = 100;
ContentValues pCV =new ContentValues();
pCV.put(Contacts.People.NAME, "test");
pCV.put(ContactsContract.Contacts._ID, Contact_Id);
Uri newContactUri = insertContentValues(cResolver,
                    Contacts.People.CONTENT_URI, pCV);

i want to add this contact to a certain Account. iam using this code below

ContentResolver cResolver = context.getContentResolver();
cResolver.insert(uri, ContactsContract.RawContacts.CONTENT_URI,
                        getAccountType()); 

public ContentValues getAccountType() {
    ContentValues cv = new ContentValues();  
    cv.put(ContactsContract.RawContacts.ACCOUNT_TYPE,  "com.sonyericsson.localcontacts");
    cv.put(ContactsContract.RawContacts.ACCOUNT_NAME, "Phone contacts");
    return cv;
}

this code actually is adding a new contact to the “Phone contacts” Account. but i want to add the contact that i added above (“test”) to be added to the “Phone contacts”.
how can i do so?

  • 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-06T19:34:08+00:00Added an answer on June 6, 2026 at 7:34 pm

    After searching I have found that the best way to insert a Contact to the Local Phone contacts is to assign the ACCOUNT_TYPE, ACCOUNT_NAME to null take a look at this Link

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

Sidebar

Related Questions

I am using below code to to create Contact Service and to Validate login
I tried following codes for adding new contact which is not working in my
I have a customizedBinding where iam adding various bindings in the CreateBindingElemens method. Everything
I am adding page numbers to the bottom of a pdf document using ITextSharp
I am adding facebook functionality to my app, and I am using the SDK
I am adding a new item to the bottom of a UITableView and after
I am adding contact functionality to my program, and I want to save the
I am trying to add contact. Adding name, phone etc are working. But adding
I am using below code: Redemption.RDOAppointmentItem objAppointment; Redemption.RDORecurrencePattern objRecurrence; objAppointment = (Redemption.RDOAppointmentItem)p_objDestFolder.Items.Add( p_objDestFolder.DefaultItemType); objAppointment.OptionalAttendees
I have a table I store contacts and their phones. Contact : ContactId (int,

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.