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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:39:16+00:00 2026-05-15T11:39:16+00:00

I’ve I’m faced to a big issue : I can’t add datas to an

  • 0

I’ve
I’m faced to a big issue : I can’t add datas to an existing contact 🙁
I’m developping an application wich manage contacts, I can add, delete or edit contacts.
The creation is ok, because I create all types of datas (even if they are empty) for the contact (this is NOT a good way, I will change this later). So when I want to edit those datas I can find them to the data base (with Datas.CONTENT_URI) ’cause they allready exist !

But if I create a new contact with the ANDROID contact application only the fill fatas are created for a contact. When I try to add new phone number for example with my application I get a error 🙁

Here is my code to try to add phone number :

ContentValues contentValues = new ContentValues();

contentValues.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Phone.CONTENT_ITEM_TYPE);
contentValues.put(ContactsContract.CommonDataKinds.Phone.NUMBER, pNewPhoneNumber.number);
contentValues.put(ContactsContract.CommonDataKinds.Phone.TYPE, pNewPhoneNumber.type);
contentValues.put(ContactsContract.Data.CONTACT_ID, pContact.getContactId());

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

ops.add(ContentProviderOperation.newInsert(
  ContactsContract.Data.CONTENT_URI).withValues(contentValues).build());

try
{
 pContext.getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
} 
catch (Exception e)
{
        Context ctx = pContext.getApplicationContext();
        String txt = "Exception encoutered while inserting contact: " + e;
        int duration = Toast.LENGTH_SHORT;
        Toast toast = Toast.makeText(ctx, txt, duration);
        toast.show();
 Log.e(TAG, txt);
}

Here is the error :

06-23 09:21:54.030: ERROR/DatabaseUtils(111): Writing exception to parcel
06-23 09:21:54.030: ERROR/DatabaseUtils(111): java.lang.NullPointerException
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at com.android.providers.contacts.ContactsProvider2.insertData(ContactsProvider2.java:2206)
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at com.android.providers.contacts.ContactsProvider2.insertInTransaction(ContactsProvider2.java:2096)
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at com.android.providers.contacts.SQLiteContentProvider.insert(SQLiteContentProvider.java:101)
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at com.android.providers.contacts.ContactsProvider2.insert(ContactsProvider2.java:1941)
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at android.content.ContentProviderOperation.apply(ContentProviderOperation.java:211)
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at com.android.providers.contacts.SQLiteContentProvider.applyBatch(SQLiteContentProvider.java:200)
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at com.android.providers.contacts.ContactsProvider2.applyBatch(ContactsProvider2.java:1960)
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at android.content.ContentProvider$Transport.applyBatch(ContentProvider.java:169)
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:167)
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at android.os.Binder.execTransact(Binder.java:287)
06-23 09:21:54.030: ERROR/DatabaseUtils(111):     at dalvik.system.NativeStart.run(Native Method)

So I have a database problem, OK. But where am I wrong ?

If you know how to solve this problem : let me know 🙂
Thank you

  • 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-15T11:39:17+00:00Added an answer on May 15, 2026 at 11:39 am

    I guess

    contentValues.put(ContactsContract.Data.RAW_CONTACT_ID, ...);
    

    is missing.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into

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.