Cursor setNotificationUri - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Cursor setNotificationUri method.

This code example shows how to use the following methods:close, getCount, getString, moveToFirst, setNotificationUri
 
        SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
        qb.setTables(args.table);
 
        Cursor ret = qb.query(db, select, args.where, args.args, null, null, sort);
        ret.setNotificationUri(getContext().getContentResolver(), url);
        return ret;
    } 
 
    @Override 
    public String getType(Uri url) {
        // If SqlArguments supplies a where clause, then it must be an item 
        // (because we aren't supplying our own where clause). 
        SqlArguments args = new SqlArguments(url, null, null);
        if (TextUtils.isEmpty(args.where)) {
            return "vnd.android.cursor.dir/" + args.table;
        } else { 
            return "vnd.android.cursor.item/" + args.table;
        } 
    } 

7
CodeRank
This code example shows how to use the following methods:setNotificationUri
  protected void notifyConversationListListeners() { 
    context.getContentResolver().notifyChange(Uri.parse(CONVERSATION_LIST_URI), null);
  } 
 
  protected void setNotifyConverationListeners(Cursor cursor, long threadId) {
    cursor.setNotificationUri(context.getContentResolver(), Uri.parse(CONVERSATION_URI + threadId));
  } 
 
  protected void setNotifyConverationListListeners(Cursor cursor) {
    cursor.setNotificationUri(context.getContentResolver(), Uri.parse(CONVERSATION_LIST_URI));
  } 
 
} 
7
CodeRank
This code example shows how to use the following methods:setNotificationUri
 
    Cursor c=
        qb.query(db.getReadableDatabase(), projection, selection,
                 selectionArgs, null, null, orderBy);
 
    c.setNotificationUri(getContext().getContentResolver(), url);
 
    return(c);
  } 
 
  @Override 
  public String getType(Uri url) {
    if (isCollectionUri(url)) {
      return("vnd.commonsware.cursor.dir/constant"); 
    } 
 
    return("vnd.commonsware.cursor.item/constant"); 
  } 
 
  @Override 
7
CodeRank
This code example shows how to use the following methods:setNotificationUri
 
    Cursor c=
        qb.query(db.getReadableDatabase(), projection, selection,
                 selectionArgs, null, null, orderBy);
 
    c.setNotificationUri(getContext().getContentResolver(), url);
 
    return(c);
  } 
 
  @Override 
  public String getType(Uri url) {
    if (isCollectionUri(url)) {
      return("vnd.commonsware.cursor.dir/constant"); 
    } 
 
    return("vnd.commonsware.cursor.item/constant"); 
  } 
 
  @Override 
7
CodeRank
This code example shows how to use the following methods:setNotificationUri
 
    Cursor c=
        qb.query(db.getReadableDatabase(), projection, selection,
                 selectionArgs, null, null, orderBy);
 
    c.setNotificationUri(getContext().getContentResolver(), url);
 
    return(c);
  } 
 
  @Override 
  public String getType(Uri url) {
    if (isCollectionUri(url)) {
      return("vnd.commonsware.cursor.dir/constant"); 
    } 
 
    return("vnd.commonsware.cursor.item/constant"); 
  } 
 
  @Override 
7
CodeRank
This code example shows how to use the following methods:setNotificationUri
 
    Cursor c=
        qb.query(db.getReadableDatabase(key), projection, selection,
                 selectionArgs, null, null, orderBy);
 
    c.setNotificationUri(getContext().getContentResolver(), url);
 
    return(c);
  } 
 
  @Override 
  public String getType(Uri url) {
    if (isCollectionUri(url)) {
      return("vnd.commonsware.cursor.dir/constant"); 
    } 
 
    return("vnd.commonsware.cursor.item/constant"); 
  } 
 
  @Override 
7
CodeRank
This code example shows how to use the following methods:setNotificationUri
    wrappedCursor.unregisterDataSetObserver(dataSetObserver);
  } 
 
  @Implementation 
  public void setNotificationUri(ContentResolver contentResolver, Uri uri) {
    wrappedCursor.setNotificationUri(contentResolver, uri);
  } 
 
  @Implementation 
  public boolean getWantsAllOnMoveCalls() { 
    return wrappedCursor.getWantsAllOnMoveCalls();
  } 
 
  @Implementation 
  public Bundle getExtras() {
    return wrappedCursor.getExtras();
  } 
 
  @Implementation 
  public Bundle respond(Bundle bundle) {
7
CodeRank
This code example shows how to use the following methods:setNotificationUri
        wrappedCursor.unregisterDataSetObserver(dataSetObserver);
    } 
 
    @Implementation 
    public void setNotificationUri(ContentResolver contentResolver, Uri uri) {
        wrappedCursor.setNotificationUri(contentResolver, uri);
    } 
 
    @Implementation 
    public boolean getWantsAllOnMoveCalls() { 
        return wrappedCursor.getWantsAllOnMoveCalls();
    } 
 
    @Implementation 
    public Bundle getExtras() {
        return wrappedCursor.getExtras();
    } 
 
    @Implementation 
    public Bundle respond(Bundle bundle) {
7
CodeRank
This code example shows how to use the following methods:setNotificationUri
        } 
 
        SQLiteDatabase db = getDatabase();
        Cursor cursor = queryBuilder.query(db, projection, selection,
                selectionArgs, null, null, sortOrder);
        cursor.setNotificationUri(getContext().getContentResolver(), uri);
 
        return cursor;
    } 
     
    @Override 
    public final String getType(Uri uri) {
        switch (sURIMatcher.match(uri)) {
        case SIMPLEENTITY_DIR:
            return CONTENT_TYPE;
        case SIMPLEENTITY_ID:
            return CONTENT_ITEM_TYPE;
        default : 
            throw new IllegalArgumentException("Unsupported URI: " + uri);
        } 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
 
    Cursor c=
        qb.query(db.getReadableDatabase(), projection, selection,
                 selectionArgs, null, null, orderBy);
 
    c.setNotificationUri(getContext().getContentResolver(), url);
 
    return(c);
  } 
 
  @Override 
  public String getType(Uri url) {
    if (isCollectionUri(url)) {
      return("vnd.commonsware.cursor.dir/constant"); 
    } 
 
    return("vnd.commonsware.cursor.item/constant"); 
  } 
 
  @Override 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
 
    Cursor c=
        qb.query(db.getReadableDatabase(), projection, selection,
                 selectionArgs, null, null, orderBy);
 
    c.setNotificationUri(getContext().getContentResolver(), url);
 
    return(c);
  } 
 
  @Override 
  public String getType(Uri url) {
    if (isCollectionUri(url)) {
      return("vnd.commonsware.cursor.dir/constant"); 
    } 
 
    return("vnd.commonsware.cursor.item/constant"); 
  } 
 
  @Override 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
 
    Cursor c=
        qb.query(db.getReadableDatabase(), projection, selection,
                 selectionArgs, null, null, orderBy);
 
    c.setNotificationUri(getContext().getContentResolver(), url);
 
    return(c);
  } 
 
  @Override 
  public String getType(Uri url) {
    if (isCollectionUri(url)) {
      return("vnd.commonsware.cursor.dir/constant"); 
    } 
 
    return("vnd.commonsware.cursor.item/constant"); 
  } 
 
  @Override 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
 
    Cursor c=
        qb.query(db.getReadableDatabase(key), projection, selection,
                 selectionArgs, null, null, orderBy);
 
    c.setNotificationUri(getContext().getContentResolver(), url);
 
    return(c);
  } 
 
  @Override 
  public String getType(Uri url) {
    if (isCollectionUri(url)) {
      return("vnd.commonsware.cursor.dir/constant"); 
    } 
 
    return("vnd.commonsware.cursor.item/constant"); 
  } 
 
  @Override 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
        SQLiteDatabase db = mBookOpenHelper.getReadableDatabase();
        // URIからテーブル名を取得 
        String tableName = uri.getPathSegments().get(0);
        Cursor cursor = db.query(tableName, projection, selection, selectionArgs, null, null, sortOrder);
        // 設定したURIの変更を監視するように設定 
        cursor.setNotificationUri(getContext().getContentResolver(), uri);
        return cursor;
    } 
 
    @Override 
    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
        isValidUri(uri);
 
        SQLiteDatabase db = mBookOpenHelper.getWritableDatabase();
        // URIからテーブル名を取得 
        String tableName = uri.getPathSegments().get(0);
        int updatedCount = db.update(tableName, values, selection, selectionArgs);
        getContext().getContentResolver().notifyChange(uri, null);
        return updatedCount;
    } 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
        appendWheres(builder, mUriMatcher, uri);
 
        SQLiteDatabase db = mHelper.getReadableDatabase();
 
        Cursor cursor = builder.query(db, null, selection, selectionArgs, null, null, sortOrder);
        cursor.setNotificationUri(getContext().getContentResolver(), uri);
        return cursor;
    } 
 
    @Override 
    public String getType(Uri uri) {
        switch (mUriMatcher.match(uri)) {
            case CODE_COLLECTION:
                return mDirType;
            case CODE_SINGLE:
                return mItemType;
            default: 
                throw new IllegalArgumentException("Unknown URI: " + uri);
        } 
    } 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
        Cursor ret = qBuilder.query(db, projection, selection, selectionArgs, null, null, orderBy);
 
        if (ret == null) {
            Log.i(TAG, "query failed");
        } else { 
            ret.setNotificationUri(getContext().getContentResolver(), uri);
        } 
 
        return ret;
    } 
 
    @Override 
    public int update(Uri uri, ContentValues values, String selection,
            String[] selectionArgs) {
        int count;
        long rowId = 0;
        int match = URI_MATCHER.match(uri);
        SQLiteDatabase db = mOpenHelper.getWritableDatabase();
 
        switch (match) {
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
        } 
 
        Cursor cursor = queryBuilder.query(mDb, projection, selection, selectionArgs,
                null, null, sortOrder);
 
        cursor.setNotificationUri(getContext().getContentResolver(), uri);
        return cursor;
    } 
 
    @Override 
    public String getType(Uri uri) {
        return TYPE;
    } 
 
    @Override 
    public Uri insert(Uri uri, ContentValues values) {
 
        if (sMatcher.match(uri) != TEMPLATES) {
            throw new IllegalArgumentException("Unknown URL " + uri);
        } 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
		Log.d(TAG, "SQLite database version: " + db.getVersion());
		Cursor c = qb.query(db, projection, selection, selectionArgs, null, null, orderBy);
 
		// Tell the cursor what uri to watch, so it knows when its source data 
		// changes 
		c.setNotificationUri(getContext().getContentResolver(), uri);
		return c;
	} 
 
	@Override 
	public String getType(Uri uri) {
		switch (sUriMatcher.match(uri)) {
		case HOSTS:
			return Hosts.CONTENT_TYPE;
 
		case HOST_ID:
			return Hosts.CONTENT_ITEM_TYPE;
 
		default: 
			throw new IllegalArgumentException("Unknown URI " + uri);
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
				null, null, orderBy);
 
		if (ret == null) {
			infoLog("ChatProvider.query: failed"); 
		} else { 
			ret.setNotificationUri(getContext().getContentResolver(), url);
		} 
 
		return ret;
	} 
 
	@Override 
	public int update(Uri url, ContentValues values, String where,
			String[] whereArgs) {
		int count;
		long rowId = 0;
		int match = URI_MATCHER.match(url);
		SQLiteDatabase db = mOpenHelper.getWritableDatabase();
 
		switch (match) {
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
				groupBy, null, orderBy);
 
		if (ret == null) {
			infoLog("RosterProvider.query: failed"); 
		} else { 
			ret.setNotificationUri(getContext().getContentResolver(), url);
		} 
 
		return ret;
	} 
 
	@Override 
	public int update(Uri url, ContentValues values, String where,
			String[] whereArgs) {
		int count;
		long rowId = 0;
		int match = URI_MATCHER.match(url);
		SQLiteDatabase db = mOpenHelper.getWritableDatabase();
 
		switch (match) {
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
        // Get the database and run the query 
        SQLiteDatabase db = mOpenHelper.getReadableDatabase();
        Cursor c = qb.query(db, projection, selection, selectionArgs, null, null, orderBy);
 
        // Tell the cursor what uri to watch, so it knows when its source data changes 
        c.setNotificationUri(getContext().getContentResolver(), uri);
        return c;
    } 
 
    @Override 
    public String getType(Uri uri) {
        switch (sUriMatcher.match(uri)) {
        case WORDS:
            return Words.CONTENT_TYPE;
 
        case WORD_ID:
            return Words.CONTENT_ITEM_TYPE;
 
        default: 
            throw new IllegalArgumentException("Unknown URI " + uri);
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
                selection,
                selectionArgs,
                groupBy,
                having,
                sortOrder);
        c.setNotificationUri(getContext().getContentResolver(), uri);
        return c;
    } 
 
    @Override 
    public int update(Uri uri, ContentValues values, String whereClause) {
        // NOTE Argument checking code omitted. Check your parameters! 
        int updateCount = mDb.update(DATABASE_TABLE_NAME, values, whereClause);
 
        // Notify any listeners and return the updated row count. 
        getContext().getContentResolver().notifyUpdate(uri, null);
        return updateCount;
    } 
 
    @Override 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
                              null, null, sort);
 
        if (ret == null) {
            if (DEBUG) Log.v(TAG, "Cities.query: failed");
        } else { 
            ret.setNotificationUri(getContext().getContentResolver(), url);
        } 
 
        return ret;
    } 
 
    @Override 
    public String getType(Uri url) {
        int match = sURLMatcher.match(url);
        switch (match) {
            case CITIES:
                return "vnd.android.cursor.dir/cities"; 
            case CITIES_ID:
                return "vnd.android.cursor.item/cities"; 
            default: 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
                break; 
        } 
 
        Cursor c = qb.query(mDb, projection, selection, selectionArgs, null,
                null, null); 
        c.setNotificationUri(getContext().getContentResolver(), uri);
        return c;
    } 
 
    @Override 
    public Uri insert(Uri uri, ContentValues values)
    { 
        long rowId = mDb.insert(PHOTOS_TABLE, "contact", values);
        if (rowId > 0)
        { 
            Uri insertedUri = ContentUris.withAppendedId(CONTENT_URI, rowId);
            getContext().getContentResolver().notifyChange(insertedUri, null);
            return insertedUri;
        } 
        throw new SQLException("Failed to insert row into " + uri);
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
        if (cursor == null) {
            if (DEBUG) {
                Log.v(TAG, "Bookmarks.query: failed"); //$NON-NLS-1$
            } 
        } else { 
            cursor.setNotificationUri(getContext().getContentResolver(), url);
        } 
 
        return cursor;
    } 
 
    /** 
     * {@inheritDoc} 
     */ 
    @Override 
    public String getType(Uri url) {
        int match = sURLMatcher.match(url);
        switch (match) {
            case BOOKMARKS:
                return "vnd.android.cursor.dir/bookmarks"; //$NON-NLS-1$ 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
            SQLiteDatabase db = mOpenHelper.getReadableDatabase();
 
            Cursor c = qb.query(db, projection, selection, selectionArgs,
                    null /* no group */, null /* no filter */, sortOrder);
 
            c.setNotificationUri(getContext().getContentResolver(), uri);
            return c;
        } 
 
        /** 
         * Return the MIME type for an known URI in the provider. 
         */ 
        @Override 
        public String getType(Uri uri) {
            switch (mUriMatcher.match(uri)) {
                case MAIN:
                    return MainTable.CONTENT_TYPE;
                case MAIN_ID:
                    return MainTable.CONTENT_ITEM_TYPE;
                default: 
6
CodeRank
This code example shows how to use the following methods:setNotificationUri
		if (sortOrder == null || sortOrder == "")
			sortOrder = COLUMN_ID;
 
		Cursor c = sqlBuilder.query(db, projection, selection, selectionArgs,
				null, null, sortOrder);
		c.setNotificationUri(getContext().getContentResolver(), uri);
		return c;
	} 
 
	@Override 
	public Uri insert(Uri uri, ContentValues values) {
		long rowID = db.insert(TABLE_NAME, "", values);
		if (rowID > 0) {
			Uri _uri = ContentUris.withAppendedId(CONTENT_URI, rowID);
			getContext().getContentResolver().notifyChange(_uri, null);
			return _uri;
		} 
		throw new SQLException("Failed to insert row into " + uri);
	} 
 
5
CodeRank
This code example shows how to use the following methods:setNotificationUri
This code example shows how to use the following methods:setNotificationUri
 
    if (c == null) {
      return null; 
    } 
 
    c.setNotificationUri(getContext().getContentResolver(), uri);
 
    return c;
  } 
 
  @Override 
  public Uri insert(final Uri uri, final ContentValues values) {
 
    return null; 
  } 
 
  @Override 
  public int update(final Uri uri, final ContentValues values, final String selection, final String[] selectionArgs) {
 
    return 0; 
5
CodeRank
This code example shows how to use the following methods:setNotificationUri
	public Bundle respond(Bundle extras) {
		return internalCursor.respond(extras);
	} 
 
	public void setNotificationUri(ContentResolver cr, Uri uri) {
		internalCursor.setNotificationUri(cr, uri);
	} 
 
	public void unregisterContentObserver(ContentObserver observer) {
		internalCursor.unregisterContentObserver(observer);
	} 
 
	public void unregisterDataSetObserver(DataSetObserver observer) {
		internalCursor.unregisterDataSetObserver(observer);
	} 
} 
4
CodeRank

Related Cursor setNotificationUri Questions & Answers:

setNotificationUri Method Overview
Register to watch a content URI for changes.
See Code Examples for other Android Cursor Methods: