Questions tagged [android-contentprovider]

Content providers are one of the primary building blocks of Android applications, providing content to applications.

Content providers are one of the primary building blocks of Android applications, providing content to applications. They encapsulate data and provide it to applications through the single ContentResolver interface. A content provider is only required if you need to share data between multiple applications.

For example, the contacts data is used by multiple applications and must be stored in a content provider. If you don't need to share data amongst multiple applications you can use a database directly via SQLiteDatabase

For more information about using content providers, read the Content Provider's documentation.

3206 questions
1
vote
1 answer

Android ContentProvider Uri Matching

I am trying to create a content provider where the key contains forward slash "/". I searched about it for quite a while but there is no place/example illustrating it. content://com.lily.provider/items/* General example, which I understand:…
Lily
  • 5,872
  • 19
  • 56
  • 75
1
vote
1 answer

Accessing Content provider android studio

i wanna acessing content provider to save and store data from web service, so when the user open the apps the data still saved. ( i just copied and manipulated script from sunshine cause i didnt know content provider work :( ) this is my script for…
cahyowhy
  • 553
  • 2
  • 9
  • 26
1
vote
0 answers

Is it possible to have multiple applications providing a preferences entity in Android?

My company provides a number of Android applications that all need a central preferences entity. For example "user_id" which is an integer that would be the same across all applications. Now the user can have 1 or any number of my company's…
Loren Rogers
  • 325
  • 3
  • 13
1
vote
1 answer

Share file from my activity to another app using FileProvider not working

I am trying to share an mp3 file created in my app using the FileProvider. I followed the documentation and this Stack Overflow post, but it is not working: for example, gmail says "Can't attach empty file". The mp3 files are saved in…
1
vote
1 answer

Changing search function in activity depending on active fragment

I have an activity with a TabLayout that's hooked up to a FragmentPagerAdapter. Whenever the user changes tabs, another fragment is loaded, but the Activity stays the same. The activity also contains a search function, i.e. autocomplete suggestions…
1
vote
2 answers

Limit number of items in SimpleCursorAdapter when using custom content provider

I'm trying to get used to using custom content providers. I've successfully managed to write a very simple application that on the press of a button adds a String to an sqlite database using a custom content provider. These database entries are then…
1
vote
1 answer

Does both ContentProvider and ContentResolver application need to be in memory to communicate?

Does both ContentProvider and ContentResolver application need to be in memory to communicate? Two applications are different and using permission to read and write.
ak0692
  • 233
  • 2
  • 13
1
vote
1 answer

How can i query the contacts content provider outside an activity?

I'm trying to query the Contacts content provider outside an Activity. But managedQuery is a method of Activity. Is there any other class/method that I can use instead of managedQuery? Here's my code: class MyActivity extends Activity { private…
javauser
  • 215
  • 1
  • 3
  • 7
1
vote
1 answer

MediaStore.Audio.Media.EXTERNAL_CONTENT_URI reported as Unknown URI

Uri uri = contentResolver.insert(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, audioValues); on some devices yields: java.lang.UnsupportedOperationException: Unknown URI: content://media/external/audio/media at…
ericwjr
  • 200
  • 2
  • 11
1
vote
1 answer

ContentDescriptor is throwing NullPointerException while instantiation

A lot of my users are facing a NullPointerException issue while instantiating content descriptor. Fatal Exception: java.lang.NullPointerException: Attempt to read from field 'java.lang.String android.content.UriMatcher.mText' on a null object…
humblerookie
  • 4,717
  • 4
  • 25
  • 40
1
vote
0 answers

FileProvider shared data - client check uri permission

I know similar questions have been asked several times here, but I am looking for a workaround. Considering the "Share"-function. Apps like Google Photos and others grant uri permissions for receiving-app components (i.e. the launched activity…
Aeefire
  • 888
  • 10
  • 25
1
vote
2 answers

Wait for ContentProvider to load before starting an activity

What technique might I use to wait for my ContentProvider to fill-up before I start a specific activity? I am using a SyncAdapter to load the ContentProvider. Normally I don't want to block my UI. But my app is a data app and the data is coming from…
1
vote
1 answer

Set text inside xml layout from JSON file

I'm searching for a way to do this. I' have a JSON file inside may project, for example mystrings.json, that is like this: { "ErrorCodes.1": "Hai superato il tempo limite", "ErrorCodes.2": "Hai superato il tempo limite" } i want to use this json in…
BoraBora
  • 565
  • 1
  • 4
  • 9
1
vote
1 answer

Reading birthday from ContactProvider, invalid column

i'm doing some tests to figure out how the provider works with events etc. I'm trying to get all contacts of specific accounts, then read details of each contact to get the birthday if present. I firstly tried to do it in 1 go but I didn't have…
user6547359
  • 204
  • 1
  • 9
1
vote
0 answers

Returning specific item from content provider using uri

I have an applet that has a main activity that shows a gridView filled with movie poster images. When you click on an image, an intent that shows additional details about the movie is called. The movie information is downloaded from a movie api and…
Joel J.
  • 425
  • 1
  • 5
  • 14