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
8
votes
1 answer

SearchManager - adding custom suggestions

I've read all of the documentation online about building search interfaces and adding custom suggestions... but I'm still unclear on how this works. The documentation says that I must "Build a table (such as in an SQLiteDatabase) for your…
Alex Lockwood
  • 83,063
  • 39
  • 206
  • 250
8
votes
2 answers

Difference between Shared Preferences and Content Providers in android

I know partially about Shared preferences and intents.But i want to know what are shared preferences and content providers in android ? And also what is the basic difference between intents , shared preferences and content providers. Please explain…
8
votes
2 answers

Deleting (Raw) Contacts in Android 2.x

I am working on Unit Tests for my Android app, and am doing a lot with Contacts. I have to insert contacts into the Android Content Providers, and delete them after running my tests. Trouble is, they do not get actually…
benfwirtz
  • 271
  • 6
  • 16
8
votes
3 answers

Android - sqlite content providers and multithreading

I'm a little confused about content providers. If I have multiple activities in my application do they each get their own instance of the content provider? it's just essentially a class/interface? In one activity I will have many threads…
user
  • 81
  • 1
  • 2
8
votes
2 answers

Android Content Provider and Many-to-Many DB relationship

I have a simple Notes app which is similar in functionality to the Android NotePad sample. One addition is that every note can have Tags. A Note can have several Tags and a Tag can belong to several Notes - thus making this a many-to-many…
curioustechizen
  • 10,572
  • 10
  • 61
  • 110
8
votes
2 answers

Android IPC and ContentProvider differences

I am trying to decide the best approach to expose encrypted content stored on phone to 3rd party apps. The content is sensitive and needs to be protected so only certain apps can access this. The approaches I'm investigating are IPC and Content…
Dom
  • 177
  • 1
  • 6
8
votes
3 answers

Trouble writing internal memory android

void launchImageCapture(Activity context) { Uri imageFileUri = context.getContentResolver() .insert(Media.INTERNAL_CONTENT_URI, new ContentValues()); m_queue.add(imageFileUri); Intent i = new…
8
votes
4 answers

java.io.FileNotFoundException caught when processing request: /document/raw:/storage/emulated/0/Download/mypdf.pdf (No such file or directory)

I want to send pdf to my server using multipart request. i am able to choose file correctly and get its name but when i am sending this pdf , i am sending following path /document/raw:/storage/emulated/0/Download/kitchenapp.pdf . path is correct…
Tejas Pandya
  • 3,987
  • 1
  • 26
  • 51
8
votes
0 answers

How to implement pagination like whatsApp, messenger Chat page (reverse scroll to load more) using CursorLoader?

My OnCreateLoader & onLoadFinished of ChatActivity are: @Override public Loader onCreateLoader(int id, Bundle args) { CursorLoader loader = new CursorLoader(this, DataProvider.CONTENT_URI_MESSAGES, …
8
votes
1 answer

How to securely share data between two or more applications in android?

I am making an application framework for the enterprise environment which involves data sharing between two or more applications from the device memory. This data needs to be stored on the device and accessible to only a few applications (which can…
8
votes
2 answers

Trying to takePersistableUriPermission() fails for custom DocumentsProvider via ACTION_OPEN_DOCUMENT

I am trying to write a custom DocumentsProvider that allows other apps to take persistable permissions to the Uris it provides I have a DocumentsProvider that I declare in my AndroidManufest.xml as follows
8
votes
3 answers

INSTALL_FAILED_CONFLICTING_PROVIDER with Facebook SDK when I build multiple productFlavors

I'm building an Android app with multiple productFlavors, and using Facebook SDK v4.1 for login and sharing contents. The problem is that when I try to install an app on a device which already has the same app installed (but different flavor), it…
8
votes
3 answers

Passing binary blob through a content provider

I have a content provider that is custom to my set of Android applications, and one of the things it needs to expose is a small (20-30 KiB) byte array. The URI for these blobs looks like: content://my.authority/blob/# where # is the row number; the…
8
votes
5 answers

How to query from MEDIA provider with "group by" option?

I'm a newbie to Android. Actually, I want to query data from Media provider with Content provider & content resolver. c = mContent.query(CONTENT_URI,projection,where,null,null); My question is, how can I query data from media provider as below…
gkshope
  • 81
  • 1
  • 2
8
votes
3 answers

Get cursor by using Realm library

I am using cursor adapter for my list view. I was planning to use content resolvers to get a cursor. Now i changed my mind to give it a chance to learn Realm. How can i get "Cursor" object by using realm? By the way, i would also be appreciate give…