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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:49:08+00:00 2026-06-04T20:49:08+00:00

I have written a Custom Content Provider on top of a SQLite Database. The

  • 0

I have written a Custom Content Provider on top of a SQLite Database. The Content Provider extends SQLiteContentProvider. The content provider send notifications at the end of many insert, delete or update operations. Now I wish to do a few update, insert and delete operation on Database but does not want any notification to be generated. How to achieve this?

Code sample from SQLiteContentProvider#bulkInsert

@Override
    public int bulkInsert(Uri uri, ContentValues[] values) {
        int numValues = values.length;
        mDb = mOpenHelper.getWritableDatabase();
        mDb.beginTransactionWithListener(this);
        try {
            for (int i = 0; i < numValues; i++) {
                Uri result = insertInTransaction(uri, values[i]);
                if (result != null) {
                    mNotifyChange = true;
                }
                mDb.yieldIfContendedSafely();
            }
            mDb.setTransactionSuccessful();
        } finally {
            mDb.endTransaction();
        }

        onEndTransaction();
        return numValues;
    }
  • 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-04T20:49:09+00:00Added an answer on June 4, 2026 at 8:49 pm

    I suggest using a different URI when calling update/insert/delete that you don’t want notifications for

    so you’ll have YourMetadata.CONTENT_URI and YourMetadata.CONTENT_URI_DONT_NOTIFY

    Then you can perform your inserts/updates/deletes as normal.. just before you notify check to see if your uri is one that you shouldn’t notify on

    If you have a URI matcher you can use the code from the match result to determine which URI you did a bulk insert on

    If not you can use

    boolean notifyChanges = YourMetadata.CONTENT_URI.equals(uri); //will be true if we want to notify on the URI
    

    then use the value of notifyChanges after you insert to determine if you want to notify or not.

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

Sidebar

Related Questions

I have a content provider that is custom to my set of Android applications,
I have written code for onClick method for Custom Dialog top of the another
I have written a custom session state provider which works fine in debug mode
I have written a custom launcher in Eclipse which I can access via the
I have written a custom control in C# (inherited from Forms.Control) and it seems
I have written a custom scaffolder for MVC3 using T4 templates to scaffold a
I have written a custom server control which (pseudo-code) looks like public class MyCustomCtrl
I have written a custom request handler in solr to meet my business requirements.
I'm using nant to build our product and have written a custom task to
I have a FragmentActivity where I have written code to create custom title bar

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.