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
0 answers

how to create or save contact in dual sim in android

private fun addContactToSim(number: String, name: String) { try { val simUri = Uri.parse("content://icc/adn") val cv = ContentValues() cv.put("tag", name) cv.put("number", number) …
1
vote
1 answer

Content Provider transaction around multiple methods

I need to create a Content Provider transaction around two methods that I didn't create but should use. Method addDog(Context, Dog) throws Exception adds a row in the Dog table. Method addToy(Context,Toy, long dogId) throws Exception adds a row in…
salyela
  • 1,325
  • 3
  • 14
  • 26
1
vote
1 answer

How to open this contentURI?

I made an image viewer that (supposedly) opens attachments from email clients, that already opens correctly PNG files. In particular, I use K9, that sends an ACTION_VIEW intent with (basically) this code: Intent intent = new…
Luis A. Florit
  • 2,169
  • 1
  • 33
  • 58
1
vote
0 answers

How to delete and update with applyBatch() in a ContentProvider?

I am implementing a ContentProvider in my app. When operations are performed, I sent an ACTION_UPDATED broadcast so that various parts of my app that use this content provider know that they must re-query for the latest data. I recently ran into a…
boltup_im_coding
  • 6,345
  • 6
  • 40
  • 52
1
vote
1 answer

Content Provider or resource, activity and service cooperation

I have a simple approach question about Android design. I envision a scenario where I provide a service and an activity. Both the service and the activity need to read/write to the same data. The basic idea is a live playlist: the service that is…
cemulate
  • 2,305
  • 1
  • 34
  • 48
1
vote
2 answers

Unable to open content: Custom Content Provider

I have two app, from another app I want to get all images, suppose there is StickerProvider and MainActivity different app StickerProvider is ContentProvider, MainActivity has ContentResolver StickerProvider App has Asset Folder Asset----> Stickers …
Siddhpura Amit
  • 14,534
  • 16
  • 91
  • 150
1
vote
1 answer

Default Photo filename using getContentResolver.insert()

I have to make some changes to one of my apps to support Android 7. I'm creating an ACTION_IMAGE_CAPTURE - Intent with a content Uri for EXTRA_OUTPUT, and I want to set the filename that is used for the image. Is there a way to do this by setting a…
Dave
  • 81
  • 5
1
vote
2 answers

Android library with SyncAdapter not running in more than 1 app in the same phone

I am creating an Android library that uses SyncAdapter to do a small task in the background every day. This works perfectly fine if used in only one app. If the same library is used by two apps in the same phone, it gives CONFLICTING_PROVIDER…
1
vote
0 answers

Unable to insert new product from menu item in my app

I am creating an inventory app.It has a fab button an menu button with two items.Everything works fine but whenever I am trying to insert a new product through the item from the menu.It doesn't add immediately. First I have to go back from the…
Vishal
  • 41
  • 11
1
vote
1 answer

Why item position in recyclerview change when update database sqlite use content provider?

I am updating my sqlite database using cursorloader inside a recyclerview where i do it by checking checkbox, the value updated but somehow the view became a mess. some row also checked but the value still 0 which should be not checked. This also…
1
vote
2 answers

Android signature protection and exported="false"

I want my ContentProvider to be available in my application only, for this purpose I set the exported attribute of ContentProvider to be false android:exported="false" This works fine and Android throws SecurityException whenever some other app…
Mickey Tin
  • 3,408
  • 10
  • 42
  • 71
1
vote
1 answer

Can't able get bytes from native google document from File Chooser using Intent.ACTION_GET_CONTENT

Content provider newbie here. I am trying to open a document from google drive using intent chooser below Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("*/*"); Intent intent = Intent.createChooser(intent, "Import…
1
vote
2 answers

Creating a ContentProvider in Android Studio 2.3.3

I'm using Android Studio 2.3.3 and was trying to add a Content Provider component to the project. I keep getting the error "URI Authorities must be a valid URI authority" even after trying many variants of the URI Authorities entry. Same results for…
1
vote
0 answers

Can't get content provider on Samsung devices

I use the TelegramGallery library. I have some problems with ContentProvider. I created a lib for getting images from a gallery or something else. It works well and returns the path for the images list, but when I want to get URI for every image,…
Alex Khotiun
  • 431
  • 4
  • 16
1
vote
0 answers

How to use Content Resolver to query SQLite database?

Currently i'm using db.query() method to access database directly and code is running perfectly. But when i try to use Content Resolver to access database using Cursor cursor = getContentResolver().query() method, the app doesn't start. I have…