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
9
votes
2 answers

Android / Java convert String date to long type

I need to convert a string in the format "dd/mm/yyyy", to a long type. In order to pass the value to the calendarProvider in android. Currently I have: Calendar calendar = Calendar.getInstance(); long startEndDate = 0; Calendar currentDateInfo =…
user1334616
9
votes
2 answers

is android:exported="true" required for internal use of content provider

I have defined a provider in my application manifest : The provider is required only to be used within the application. But…
faizal
  • 3,497
  • 7
  • 37
  • 62
9
votes
1 answer

Edit/Delete Google Calendar Events and get event Id

I am trying to edit and delete events in Google calendar using Calendar Provider. I have already Created event using Calendar Provider . Here is my code to create an event : Calendar beginTime = Calendar.getInstance(); beginTime.set(2014, 5,…
9
votes
1 answer

Why doesn't MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI provide an accurate "Album Artist"?

I'm working with the android MediaStore. I can get a list of music on the device, and all the details associated with each media item (title, artist, duration, etc.) I would like to be able to show a list of Albums, with their Album Artist. To be…
Matt
  • 3,837
  • 26
  • 29
9
votes
1 answer

How to query the MMS Log in Android

In my app I need to query both the SMS and the MMS log to get the history of all incoming and outgoing messages. This code has worked wonderfully for SMS: Cursor c = cr.query(Uri.parse("content://sms"), null, null, null, null); But when I try the…
Mark B
  • 183,023
  • 24
  • 297
  • 295
9
votes
4 answers

Android ContentProvider vs ORMLite

I'm using content provider to manage my application data, which is not shared with other applications. However, there is some boilerplate code such as translating the cursor to domain object. ORMLite provides a more elegant way that mapping the…
manshuai
  • 803
  • 2
  • 9
  • 17
9
votes
2 answers

Trigger Android stock MMS app to send out pending messages

Now that 3rd party apps cannot read APN information, it seems that there's no way to send MMS programmatically (unless you ask the user to manually enter APN info -AND- you have a working APN defined in the phone's settings), so the only option…
Lior
  • 7,845
  • 2
  • 34
  • 34
9
votes
3 answers

Shared Content Provider

My application has two versions, a free and pro version and the Content Provider for the app data needs to be shared between the two. It should be designed keeping the following in mind Data created by any version should be visible in the other…
Soham
  • 4,940
  • 3
  • 31
  • 48
9
votes
1 answer

Singleton vs a static inner class for Database Helper class in Android

I am trying to see which of these implementation is better for accessing sqlite database in Android Applications Implementation 1 Using DatabaseHelper classes extending SqliteOpenHelper and using singleton pattern. In some rare occasions I do see…
achie
  • 4,716
  • 7
  • 45
  • 59
9
votes
3 answers

CursorLoader - Two tables join query?

I am having two tables with 1:1 relationship, I am using content provider and cursorloader. How would I make a join query to work with cursor loader? I could hack it up somehow with rawSql inside content provider but how to do it in cursor loader…
urSus
  • 12,492
  • 12
  • 69
  • 89
9
votes
1 answer

MediaStore: get image data, thumbnail and folder

I have two lists. Let's call them AlbumsList and PicturesList. The first one shows photo album cover (one of the images from it) it's name and number of pictures in it. The second one shows all of the images contained in a chosen album. I've…
Lingviston
  • 5,479
  • 5
  • 35
  • 67
9
votes
1 answer

How to share internal storage file with Gmail Client

I am trying to share my internal storage file via Gmail client on my Moto Razr, but every time I sent to my test gmail account, I got everything except attachment. This is how I invoke and start gmail, while add file as attachment. private void…
antonio081014
  • 3,553
  • 1
  • 30
  • 37
9
votes
1 answer

Restrict access to content provider

I did not find a post which ask for the same restriction as me. I have an application which provides a content provider (call it main application) to other applications (call them client applications). I want restrict the access to the content…
FabiF
  • 2,796
  • 2
  • 18
  • 27
9
votes
3 answers

Batch Delete items with Content Provider in Android

I'm trying to batch delete some items in a table. String ids = { "1", "2", "3" }; mContentResolver.delete(uri, MyTables._ID + "=?", ids); However I keep getting this following error java.lang.IllegalArgumentException: Too many bind…
8
votes
1 answer

Best practices for synchronizing a SQL database with a REST remote server on Android

I have a custom Android ContentProvider which stores and retrieves data from a SQLite database. Let's assume one of the DB tables has an _ID column and a NAME column and a content like this: |==========|==========| | _ID | NAME …
Lorenzo Polidori
  • 10,332
  • 10
  • 51
  • 60