Code example for Uri

Methods: notifyChange, getPathSegments

    public synchronized int update(Uri uri, ContentValues values, String selection,
            String[] selectionArgs) {
        assert(uri.getPathSegments().size() == 1);
        // In this sample, we only update the content provider individually for each row with new 
        // temperature values. 
        final int index = Integer.parseInt(uri.getPathSegments().get(0));
        final MatrixCursor c = new MatrixCursor(
                new String[]{ Columns.ID, Columns.CITY, Columns.TEMPERATURE });
        assert(0 <= index && index < sData.size());
        final WeatherDataPoint data = sData.get(index);
        data.degrees = values.getAsInteger(Columns.TEMPERATURE);
        // Notify any listeners that the data backing the content provider has changed, and return 
        // the number of rows affected. 
        getContext().getContentResolver().notifyChange(uri, null);
        return 1;