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. Intel Drops an 鈥楢tom` Brand

The chip maker new Atom brand includes its Diamondville chip for low-
cost laptops and its Silverthorne processor for mobile Internet
devices.




for more info visit  http://www.intel-intel99.blogspot.com
--~--~---------~--~----~------------~-------~--~----~

2. Preference#setSummary does not properly repaint

When I use runtime Preference#setSummary(CharSequence) I see new value
painted on the top of the old one. Looks very ugly. Is there any
settings I'm missing? Behaves the same way in both 1.1 and 1.5
--~--~---------~--~----~------------~-------~--~----~

3. How to set minimum value for SeekBar?

4. Strategies for alerting users about new versions of your app in the appstore?

5. which width and height for a 2*1 cell widget? 160*100? Bug in Widget?

6. incomingNumber -> contact name - What is the right way?

7. HTC G1 Dream with cupcake STK (SIM Toolkit) not found