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

  • Home
  • SEARCH
  • 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 6806237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:41:10+00:00 2026-05-26T19:41:10+00:00

EDIT: I suspect this is resulting from a bug in my HTC sense UI.

  • 0

EDIT: I suspect this is resulting from a bug in my HTC sense UI. I would also accept an answer allowing me to test this theory without losing any phone data (i.e. hard reset or otherwise). The phone is an HTC Incredible running Froyo 2.2.

I’m trying to insert a large batch of contacts (parsed into an object through XML, but basically from a custom Object) and I’m having the above problem.

Contacts are adding just fine (to the “com.google” account), but for each contact added, there is a contact “unnamed” added to the top of the list with no data.

ctaList is my “contact to add” list

tempFlr is my object holding all of the contacts to add originally.

Code:

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

---------------------------------------------------------------------------
ArrayList<ContactToAdd> ctaList = new ArrayList<ContactToAdd>();
                constructCtaList(tempFlr, ctaList);

                ops.addAll(fillContentProviderOperation(accounts, ctaList,
                        ops));

---------------------------------------------------------------------------

private void constructCtaList(final FrontLineResponse tempFlr,
                ArrayList<ContactToAdd> ctaList) //
{
    for (Customer c : tempFlr.Customers) //
    {
        for (Applicant app : c.Applicants) //
        {
            ContactToAdd cta = constructContactToAdd(c, app);
            ctaList.add(cta);
        }
    }
}

---------------------------------------------------------------------------

protected ArrayList<ContentProviderOperation> addToContacts(
        ContactToAdd cta, int opsLength, Account[] accounts) //
{

    // opsLength is used to store the index to point at the RawContact
    // created here
    ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();

    ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI)
            .withValue(RawContacts.ACCOUNT_TYPE, accounts[0].type)
            .withValue(RawContacts.ACCOUNT_NAME, accounts[0].name).build());

    ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
            .withValueBackReference(Data.RAW_CONTACT_ID, opsLength)
            .withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)
            .withValue(StructuredName.GIVEN_NAME, cta.FirstName)
            .withValue(StructuredName.FAMILY_NAME, cta.LastName).build());

    ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
            .withValueBackReference(Data.RAW_CONTACT_ID, opsLength)
            .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
            .withValue(Phone.NUMBER, cta.DayWorkPhoneNumber.PhoneNumber)
            .withValue(Phone.TYPE, Phone.TYPE_MOBILE).build());

    ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
            .withValueBackReference(Data.RAW_CONTACT_ID, opsLength)
            .withValue(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE)
            .withValue(Email.DATA1, cta.Email)
            .withValue(Email.TYPE, Email.TYPE_MOBILE).build());

    ops.add(ContentProviderOperation
            .newInsert(Data.CONTENT_URI)
            .withValueBackReference(Data.RAW_CONTACT_ID, opsLength)
            .withValue(Data.MIMETYPE, StructuredPostal.CONTENT_ITEM_TYPE)
            .withValue(StructuredPostal.STREET, cta.MailingAddress.Address1)
            .withValue(StructuredPostal.CITY, cta.MailingAddress.City)
            .withValue(StructuredPostal.REGION,
                    cta.MailingAddress.StateCode)
            .withValue(StructuredPostal.POSTCODE,
                    cta.MailingAddress.PostalCode)
            .withValue(StructuredPostal.TYPE, StructuredPostal.TYPE_HOME)
            .build());

    ops.add(ContentProviderOperation
            .newInsert(Data.CONTENT_URI)
            .withValueBackReference(Data.RAW_CONTACT_ID, opsLength)
            .withValue(Data.MIMETYPE, StructuredPostal.CONTENT_ITEM_TYPE)
            .withValue(StructuredPostal.STREET,
                    cta.ShippingAddress.Address1)
            .withValue(StructuredPostal.CITY, cta.ShippingAddress.City)
            .withValue(StructuredPostal.REGION,
                    cta.ShippingAddress.StateCode)
            .withValue(StructuredPostal.POSTCODE,
                    cta.ShippingAddress.PostalCode)
            .withValue(StructuredPostal.TYPE, StructuredPostal.TYPE_WORK)
            .build());

    return ops;
}

Thanks!

  • 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-26T19:41:11+00:00Added an answer on May 26, 2026 at 7:41 pm

    It looks like this is a peculiarity of the Sense UI for HTC. This was solved by simply cleansing the data before I inserted it into the ContentProvider.

    Hope this helps anybody confused by this!

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

Sidebar

Related Questions

EDIT: There's now a doc page on this so this question is irrelevant, also
I suspect this answer is in SO but I cannot find it. Some reports
I suspect this is a bug in library(foreign) but I am not sure. When
EDIT: This post was originally specific to ASP.NET, but after thinking about it I'm
edit alright, I guess C is painful in nature--Just, this part, is particularly painful.
I suspect this might be a very simple mistake but I've spent 3 hours
I keep getting 500 (Internal Server Error) and I suspect this is because I
EDIT: Just to clarify, my main question boils down to this: if you issue
EDIT: I wasn't sure if this should be a new question or not so
EDIT: Duplicate of Should Entity Framework Context be Put into Using Statement? I've been

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.