Questions tagged [android-contentresolver]

A ContentResolver represents the connection between an app requesting data and the target ContentProvider.

A ContentResolver represents the connection between an app requesting data and the target ContentProvider. A typical way to access the ContentResolver is through the getContentResolver() method of an Activity.

1031 questions
14
votes
6 answers

Failed to find provider info error

I am trying to have a contentprovider , but I am having trouble because I am getting an error of "Failed to find provider info for com.example.alex.hopefulyworks" Here is the manifest and the contentprovider
13
votes
4 answers

How can I call getContentResolver in android?

I'm writing a library class to encapsulate some of my logic in my first Android app. One of the functions which I want to encapsulate is a function which queries the address book. As such, it needs a ContentResolver. I'm trying to figure out how to…
eidylon
  • 7,068
  • 20
  • 75
  • 118
13
votes
3 answers

How to store large blobs in an android content provider?

I have some large files (images and video) which I need to store in a content provider. The android documentation indicates... If you are exposing byte data that's too big to put in the table itself — such as a large bitmap file — the field…
13
votes
3 answers

Android fetch all contact list (name, email, phone) takes more then a minute for about 700 contacts

Is there any way to shorten this time? I'm running with the cursor and takes the name, phone numbers and emails if I remove the phone numbers query from the query loop it ends in 3 seconds any idea how can I improve that query? Maybe I'm doing…
itay83
  • 410
  • 1
  • 6
  • 18
13
votes
2 answers

Android get sms from inbox, optimized way to read all messages and group them

Hi am implementing a SMS App, now am able to retrieve all messages with their respective contact info like display name, photo uri.. and am displaying them in a custom list where on item click takes you to respective discussion. Here my issues is…
12
votes
3 answers

java.lang.IllegalArgumentException Volume external_primary not found in Android 10 devices

Crash : java.lang.IllegalArgumentException Volume external_primary not found When querying for tracks from media store, I am getting this crash in some Android 10 devices (Most of them are from Xiaomi Mi A2 Lite, Motorola, HMD Global Nokia). Cursor…
12
votes
2 answers

How to get media item real_Path from contentResolver.openFileDescriptor(Uri uri, String s) in Android Q?

MediaStore.MediaColumns.DATA constant was deprecated in API level Q. Apps may not have filesystem permissions to directly access this path. Instead of trying to open this path directly, apps should use ContentResolver#openFileDescriptor(Uri, String)…
12
votes
1 answer

Calling delete method in custom content provider

I am learning Android and I am stuck on an issue involving calling a custom content provider. I have been using an example in an instructional book and although it describes how to create the custom provider there is no clear example how to call the…
12
votes
6 answers

Android: getContext().getContentResolver() sometimes gets NullPointerException

I want to ask why we get this annotation: Method invocation getContext.getContentResolver() may produce NullPointerException Why is it there and not in other parts of program Fragment/Activity? That approach has been used in tutorial made by…
Radek O
  • 418
  • 1
  • 4
  • 12
12
votes
1 answer

SyncAdapter always in pending state

I'm currently working on an android app which relies on a SyncAdapter to refresh its content from a server. I basically followed these instructions: https://developer.android.com/training/sync-adapters/creating-sync-adapter.html This worked…
12
votes
4 answers

Android Create Playlist

Anyone know how to add playlists to Android in code? I kind of get that I have to insert it into the content resolver but do I have to just put the song id in or do I have to put all of the song's data in? I have been looking for sample code but…
shaneburgess
  • 15,702
  • 15
  • 47
  • 66
12
votes
2 answers

is it possible to replace the MediaStore with a test double using robolectric?

I have a class that queries the MediaStore for images. For example, I have code that looks like someContentResolver.query( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, ... ). I want to test that, among other things, my queries to the MediaStore…
12
votes
1 answer

How to load a Picasa image from URI?

I'm using ACTION_PICK intent to select an image from gallery. Some albums like "Posts", "Profile Photos", etc are marked with Picasa icon. For images from such albums I get a URI similar to…
12
votes
1 answer

ContentResolver usage

I am new to andriod domain and is in learning phase. I got couple of queries: Do we have single ContentResolver object per app? Is it a singleton object? Who manages this object lifecycle? If it's singleton, how does it handles multiple request of…
loc
  • 125
  • 1
  • 7
12
votes
3 answers

`getContentResolver().openInputStream(uri)` throws FileNotFoundException

I use this intent to let user select a photo: Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI); startActivityForResult(intent, INTENT_SELECT_PHOTO); And in…
Freewind
  • 193,756
  • 157
  • 432
  • 708
1 2
3
68 69