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

How to load a URI with "content://" prefix using Glide Android?

I'm trying to load a Contact photo with URI "content://com.android.contacts/contacts/295" by using Glide. When I use Glide.with(context).load(Uri.parse(contactPhoto).into(imageview) Glide gives me a FileNotFoundException…
8
votes
3 answers

How to decide when to run different android applications components in a separate process

I have read the following statements here By default, all components of the same application run in the same process and most applications should not change this. However, if one needs to control which process a certain component belongs to, he can…
8
votes
3 answers

Use Insert or Replace in ContentProvider

When I want to check and see if something exists in my ContentProvider what I usually do is something similar to this Cursor c = getContentResolver().query(table,projection,selection,selectionArgs,sort); if(c != null && c.moveToFirst()){ …
tyczj
  • 71,600
  • 54
  • 194
  • 296
8
votes
0 answers

Which conditions cause SQLiteDiskIOException code 3850

I have an app that uses ContentProvider to access SQLite. An instance of SQLiteOpenHelper is created in providers onCreate: @Override public boolean onCreate() { final Context context = getContext(); mDBHelper = new MyDatabase(context); …
Jukka Raanamo
  • 451
  • 3
  • 8
8
votes
2 answers

How to get the size of the data received via EXTRA_STREAM in an application handling the action send intent?

When another application is sending a file to my app, I get a Uri via the intent.getExtras().get(EXTRA_STREAM) property. I can then get the bytes of the file using an inputstream : new…
8
votes
3 answers

Disable notifications on a ContentProvider URI

I'm looking for a way to suspend notifications on a given ContentProvider's Uri. The use case is: An Activity is bound to a CursorAdapter through a CursorLoader. A Service may do a lot of batch, single-row updates on a ContentProvider. The…
frapontillo
  • 10,499
  • 11
  • 43
  • 54
8
votes
0 answers

Get Contact Photo based on Contact PhoneNumber Android - Working Example

Android 2.3.3 I have looked at various examples on how to get "Photo of a Contact". But none of them worked for me. Surprisingly, I have stumbled upon a code at StackOVerFlow and I used it and could get the "Photo" and display it in ImageView in my…
8
votes
3 answers

How to use bulkInsert() function in android?

I want only a single notification after all the bulk insertion is done into database. Please provide an example to use bulkInsert() function. I cannot find a proper example on internet. Please Help!!!!
Arpit
  • 438
  • 1
  • 6
  • 15
8
votes
3 answers

Android Web browser homepage

I have seen several apps and advertising networks like startapp changing the android web browser homepage by code. How is this possible? I have taken a look at the startapp sdk but i have not managed to find the part where they change the…
Anonym..
  • 333
  • 1
  • 5
  • 18
8
votes
1 answer

How to properly setup the syncAdapter?

I'm a newb with the syncAdapter . i've watched the google IO video (lecture presentation here) , and i've read 2 tutorials (here and here) about it . i've also tried out the code of the tutorials and it's frustrating that i can't figure out how to…
7
votes
3 answers

ContentProvider with multiple tables

I want to implement a ContentProvider that manipulates multiple tables. Here is what I tried so far. I wrote a Java Interface that represents the CRUD operations that every table should implement in its CRUD class. public interface CRUDHandler { …
confucius
  • 13,127
  • 10
  • 47
  • 66
7
votes
2 answers

How to implement read-only ContentProvider?

I am wondering how to best implement a read-only ContentProvider. I want my data source to be modified only from within my own application through additional special methods of my ContentProvider (which of course are not accessible through a…
7
votes
2 answers

Android contentprovider insert takes a lot of time

I made my own contentprovider where I put a lot of data in at once with multiple inserts. The app will receive the data from an external source and at this moment I receive about 30 items (therefor 30 times an insert). Now I noticed that this…
Ion Aalbers
  • 7,830
  • 3
  • 37
  • 50
7
votes
3 answers

Access Context in ContentProvider

I have a ContentProvider Class and a DatabaseHelper Class (extends SQLiteOpenHelper). The ContentProvider instantiates the Helper which needs access to a Context because the constructor requires it: public DBHelper(Context context,…
Julian
  • 539
  • 3
  • 7
  • 20
7
votes
4 answers

Android duplicate provider authority problem

We're trying to publish a pay ad-free version of a casual app that's currently published free with ads. We refactored all package names to com.mycompanyname.appname.pro, the free one on market doesn't have the .pro at the end, basically. We also…
thefish7
  • 83
  • 1
  • 2
  • 6