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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:26:11+00:00 2026-06-01T10:26:11+00:00

working on a content provider and I’m having an issue with it. When I

  • 0

working on a content provider and I’m having an issue with it. When I try to update a certain row in the SQLite database through the content provider, it updates the column in all the rows, not just the row I specify. I know the CP is working because I can access it, populate a listview with it, and change the content of column, but never just one column.

Here is the relevant update method

public int update(Uri url, ContentValues values, String where,
            String[] whereArgs) {
        SQLiteDatabase mDB = dbHelper.getWritableDatabase();
        int count;
        String segment = "";
        switch (URL_MATCHER.match(url)) {
        case ITEM:
            count = mDB.update(TABLE_NAME, values, where, whereArgs);
            break;
        case ITEM__ID:
            segment = url.getPathSegments().get(1);
            count = mDB.update(TABLE_NAME, values,
                    "_id="
                            + segment
                            + (!TextUtils.isEmpty(where) ? " AND (" + where
                                    + ')' : ""), whereArgs);
            break;

        default:
            throw new IllegalArgumentException("Unknown URL " + url);
        }
        getContext().getContentResolver().notifyChange(url, null);
        return count;
    }

and here is the code I use to (try to) update it.

ContentValues mUpdateValues = new ContentValues();

mUpdateValues.put(ContentProvider.HAS, "true");
mUpdateValues.put(ContentProvider.WANT, "false");

mRowsUpdated = getContentResolver().update(Uri.parse(ContentProvider._ID_FIELD_CONTENT_URI
+ rowId), mUpdateValues, null, null);

and here is the URI

URL_MATCHER.addURI(AUTHORITY, TABLE_NAME + "/#", ITEM__ID);

Thanks, any help would be appreciated.

EDIT I have also tried

mRowsUpdated = getContentResolver().update(
                    ContentProvider._ID_FIELD_CONTENT_URI, mUpdateValues,
                    null, null);

and

mRowsUpdated = getContentResolver().update(
                    ContentProvider.CONTENT_URI, mUpdateValues,
                    null, null);
  • 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-01T10:26:12+00:00Added an answer on June 1, 2026 at 10:26 am

    You are not specifying a WHERE clause, which is what is used to update only specific rows. The default behavior of content providers is to update all the rows, unless you specify conditions.

    From the docs:
    developer.android.com/reference/android/content/ContentResolver.html

    Parameters
    uri     The URI to modify.
    values  The new field values. The key is the column name for the field. A null value will remove an existing field value.
    where   A filter to apply to rows before updating, formatted as an SQL WHERE clause (excluding the WHERE itself).
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a content management system for updates where the administrator can
I am working on a android application which read the sms from content provider.
I am currently working with the Android Contacts content provider and currently can access
I am working on a content management application in which the data being stored
I dont knwo why the Jquery fade in is not working for my content
I'm working on an application that gets content from feeds in C#. This content
The Content Assist in Eclipse 3.4 and 3.5 has stopped working for me. When
Currently I'm working on to display Epub content in UIWebview . From this link
I am currently working on a project which requires migration of content from different
I'm currently working on an asp.net-mvc content management system. It would be incredibly useful

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.