Best code examples for Android ContentResolver class (android.content.ContentResolver)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ContentResolver class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android ContentResolver examples from Open Source projects
Examples using Android ContentResolver query method:
This code example shows how to use the following methods: query
44:	Bitmap contactPhoto = localUserContactPhotoCache.get(uri); 
-
47:	Cursor cursor = context.getContentResolver().query(uri, CONTENT_URI_PROJECTION, 
-
57:	localUserContactPhotoCache.put(uri, contactPhoto); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: query
75:	socialFeed = SocialFeed.fromCursor(contentResolver.query(socialFeedUri, null, null, null, null)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: query
104:	feedCursor = contentResolver.query(feedUri, null, null, null, null); 
Full Snippet Info
7
CodeRank
Examples using Android ContentResolver insert method:
This code example shows how to use the following methods: insert, openAssetFileDescriptor, query, update
92:	long rawId = queryForRawContactId(cr, Long.parseLong(id)); 
-
109:	Cursor cursor = cr.query(ContactsContract.Data.CONTENT_URI, null, where, null, null); 
-
141:	cr.update(uri, values, null, null); 
-
146:	cr.update(uri, values, null, null); 
-
152:	cr.insert(uri, values); 
-
162:	AssetFileDescriptor fd = cr.openAssetFileDescriptor(rawContactPhotoUri, "rw"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: insert
113:	return resolver.insert(uri, values); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: insert, put
56:	ContentValues values = new ContentValues(); 
57:	values.put(MediaStore.Images.Media.TITLE, filename); 
58:	values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg"); 
59:	mPictureUri = getContentResolver().insert( 
Full Snippet Info
7
CodeRank
Examples using Android ContentResolver update method:
This code example shows how to use the following methods: update, put
52:	ContentValues values = new ContentValues(); 
53:	values.put(Calls.NEW, 0); 
54:	values.put(Calls.IS_READ, 1); 
-
60:	getContentResolver().update(Calls.CONTENT_URI, values, where.toString(), 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: query, update
46:	resolv.update(AwfulPost.CONTENT_URI, 
-
53:	resolv.update(AwfulPost.CONTENT_URI, 
-
59:	Cursor threadData = resolv.query(ContentUris.withAppendedId(AwfulThread.CONTENT_URI, threadId), AwfulProvider.ThreadProjection, null, null, null); 
-
63:	resolv.update(AwfulThread.CONTENT_URI, 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: insert, query, update
162:	Uri uri = mResolver.insert(REGISTRY_URI, value); 
-
168:	assertEquals(1, mResolver.update(uri, value, null, null)); 
-
170:	Cursor cur = mResolver.query(uri, new String[] { 
Full Snippet Info
7
CodeRank
Examples using Android ContentResolver notifyChange method:
This code example shows how to use the following methods: notifyChange, getPathSegments
81:	String tableName = uri.getPathSegments().get(0); 
-
83:	getContext().getContentResolver().notifyChange(uri, null); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: notifyChange, getPathSegments
153:	id = uri.getPathSegments().get(1); 
-
162:	getContext().getContentResolver().notifyChange(uri, null); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: notifyChange, getPathSegments
114:	String rowId = uri.getPathSegments().get(1); 
-
127:	getContext().getContentResolver().notifyChange(uri, null); 
Full Snippet Info
7
CodeRank
Examples using Android ContentResolver delete method:
This code example shows how to use the following methods: delete, insert, query
62:	Cursor cursor = resolver.query(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, 
-
92:	Uri uri = resolver.insert(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, values); 
-
97:	resolver.delete(uri, null, null); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: delete
336:	cr.delete(uri, People._ID + "=" + id, null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: delete
162:	return query.runQuery(resolver); 
-
224:	resolver.delete(ContentUris.withAppendedId(uri, getItemId(position)), null, null); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: openInputStream, openOutputStream
64:	InputStream in = mResolver.openInputStream(mUri); 
-
68:	OutputStream out = mResolver.openOutputStream(mUri, "rwt"); 
Full Snippet Info
7
CodeRank
Examples using Android ContentResolver getType method:
This code example shows how to use the following methods: getType, openAssetFileDescriptor
244:	String mimeType = contentResolver.getType(uri); 
245:	AssetFileDescriptor assetFd = contentResolver.openAssetFileDescriptor(uri, "r"); 
Full Snippet Info
6
CodeRank
Examples for other Android ContentResolver methods:
Related Android ContentResolver Questions & Answers:
Other Android ContentResolver Examples
68:	    values.put(MediaStore.Audio.Media.MIME_TYPE, "audio/3gpp");
69:	    values.put(MediaStore.Audio.Media.DATA, audiofile.getAbsolutePath());
70:	    ContentResolver contentResolver = getContentResolver();
71:	
72:	    Uri base = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;

Read More

ContentResolver Class Overview
This class provides applications access to the content model.

Developer Guides For more information about using a ContentResolver with conte...
Methods
  • applyBatch
    Applies each of the ContentProviderOperation objects and returns an array of their results.
  • delete
    Deletes row(s) specified by a content URI.
  • getType
    Return the MIME type of the given content URL.
  • insert
    Inserts a row into a table at the given URL.
  • notifyChange
    Notify registered observers that a row was updated.
  • openInputStream
    Open a stream on to the content associated with a content URI.
  • query
    Query the given URI, returning a Cursor over the result set.
  • registerContentObserver
    Register an observer class that gets callbacks when data identified by a given content URI changes.
  • update
    Update row(s) in a content URI.