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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:54:35+00:00 2026-06-14T15:54:35+00:00

I am applying a batch of ContentProviderOperations on my provider: ContentProviderResult[] result = resolver.applyBatch(…)

  • 0

I am applying a batch of ContentProviderOperations on my provider:

ContentProviderResult[] result = resolver.applyBatch(...)

Everything works as expected the data is being inserted into the DB, but if I want to extract the id(s) the last element of the uri which should be the id is always null.

Is this happening because I have set the _id of the table to autoincrement (in other words would it work if I am not autoincrementing the id and fill it with a manually uid from my code).

If not, can anyone tell me whats causing this behavior.

Update: This is the String for creating the table:

    private static final String CREATE_TABLE_WORKFLOWSTATES =
        "CREATE TABLE " + Tables.WORKFLOWSTATES + " (" 
        + BaseColumns._ID + " INTEGER PRIMARY KEY AUTOINCREMENT,"
        + WorkflowStatesColumns.NAME + " TEXT NOT NULL,"
        + "UNIQUE ("+ WorkflowStatesColumns.NAME + ") ON CONFLICT IGNORE)";

and if i view the table I can see the columns _id and name, the inserted data that is visible shows that the autoincrement works properly.

Update 2: This is how I have build the ContentProviderOperation:

this is my ArrayList with ContentProviderOperations (CollectionUtils is a custom class in order to instantiate the Arraylist):

ArrayList<ContentProviderOperation> batch = CollectionUtils.newArrayList();

and this is the actual operation:

batch.add(ContentProviderOperation
    .newInsert(InvoiceContract.addCallerIsSyncAdapterParameter(WorkflowStates.CONTENT_URI))
    .withValue(WorkflowStates.NAME, task.getWFS()).build());
  • 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-14T15:54:37+00:00Added an answer on June 14, 2026 at 3:54 pm

    In case of insertion (and I guess that you insert a row into your database), the result[i].uri contains URI of a newly inserted row, where i is the index of the corresponding operation in operations array. Try to print this URI and you’ll see if it corresponds to real id.

    If one of your operation is UPDATE or DELETE the corresponding result URI will be null, but result[i].count will contain the number of updated/deleted rows.

    UPDATE

    I guess the problem is that you have a unique index on NAME. Maybe, you have a row already inserted with the same name?

    UPDATE2

    The problem was that the insert function in the ContentProvider did not return the id correctly.

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

Sidebar

Related Questions

I'm applying the following example http://jsoup.org/cookbook/extracting-data/example-list-links to list links. package org.jsoup.examples; import org.jsoup.Jsoup; import
I'm applying some css3 effects using a function it works fine on body page
I am applying an event listener function when elements are inserted into the document
I am applying join query to fetch data from database on my iPhone app.
I'm applying the following filter to my data. string[] options = new string[2]; options[0]
During applying data I use notifyChange with an Uri . Let's say I notify
When applying TDD, do you create tests that verify expected exceptions for arguments (ArgumentException,
I found applying the following function to a links onclose works to close Fancybox
Upon applying this code: $lines = explode(\n, $val); where $val = $_POST['result']; and $_POST['result'];
Problem: Applying $(.price).hide(); works to elements already rendered, however, when I load a new

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.