Why corsor need to call setNotificationUri when query from content provider?

by 榛冨啝瀹 » Tue, 28 Apr 2009 09:36:06 GMT


Sponsored Links
 Hi,I don't got what you mean.

    @Override
    public Cursor query(Uri uri, String[] projection, String
selection, String[] selectionArgs,
            String sort) {
        SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
        qb.setTables(TASKS_TABLE);
        String orderBy;

        if (TextUtils.isEmpty(sort)) {
            orderBy = TASK_COMPLETED + " DESC" + ", " + TASK_PRIORITY
+ ", " + TASK_ID;
        } else {
            orderBy = sort;
        }

        switch (mURIMatcher.match(uri)) {
            case TASKS_SINGLE:
                qb.appendWhere(TASK_ID + "=" + uri.getPathSegments().get(1));
                break;
            default:
                break;
        }

        Cursor c = qb.query(mTasksDb,
                projection,
                selection, selectionArgs,
                null, null,
                orderBy);

            c.setNotificationUri(getContext().getContentResolver(), uri);


        return c;
    }

In above query implementation for content provider,
can I delete the line c.setNotificationUri(getContext().getContentResolver(),
uri) ??
thanks

2009/4/22 Marco Nelissen <marc...@android.com>




--~--~---------~--~----~------------~-------~--~----~



Why corsor need to call setNotificationUri when query from content provider?

by Eric Chen » Tue, 28 Apr 2009 11:43:16 GMT


 How about Update , it is need followed by setNotificationUrl?
Best Regards

Eric Chen







--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Why corsor need to call setNotificationUri when query from content provider?

by Marco Nelissen » Tue, 28 Apr 2009 12:06:51 GMT


 



You can certainly do that if you want to, but if you do, then you won't be
notified if someone goes and modifies the data.

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. android-developers - 84 new messages in 56 topics - abridged



The message tells you which class was not found, and which class/
method was trying to create an instance of it.  You didn't paste the
important parts of the message here.

Usually problems like this can be corrected by adding a "uses-library"
directive to your manifest.

--~--~---------~--~----~------------~-------~--~----~

2. Android SDK v1.1 due soon?

I recently upgraded to RC33 on my G1 and when I uploaded an
application from within eclipse, I received a message warning that the
SDK version on the phone was 1.1, which did not match the SDK version
of 1.0 I am using.

I was wondering when the 1.1 SDK will be available for developers.
I'm not noticing any issues, and I am not sure what, if any, new
functionality has been added to the 1.1 SDK.  Just thought I'd ask.

Regards,
Scheff's Blend.
--~--~---------~--~----~------------~-------~--~----~

3. How to indicate a carriage return in strings?

4. Should cursors used in autocomplete adapters be managed or not?

5. How to Layout

6. Trying to Build Term.apk

7. How ACTION_CHOOSER picks choices for ACTION_SET_WALLPAPER