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

Is there a "proper" way to keep a content provider implementation seperate from it's users?

I have a custom ContentProvider class, which I originally developed in the same project file with the application using it. However since this application is intended to be only one of many users of the ContentProvider, I want to split it in a…
tvelocity
  • 11
  • 2
1
vote
1 answer

ContentProvider (contacts) - no such column: metadata_dirty

I'm trying to get all contacts of a specific type from the phone like following: Cursor cursor = context.getContentResolver().query( ContactsContract.RawContacts.CONTENT_URI, null, …
1
vote
0 answers

How to read failed messages using Telephony class?

Using telephony class,Telephony.Sms.CONTENT_URI shows the content uri of the message database, but using this content uri, it won't loop through the failed messages, it only shows inbox outbox sent messages. How can i access through the failed…
user7423615
1
vote
1 answer

ContentProvider's query(..) method is never called ,due to which i am getting no suggestions

I have created a searchView with Custom Suggestion using the SQLiteDataBase but the query() method is never called and hence it is not showing any suggestions. Code for my ContentProvider package com.example.abhishek.fblogin.helper; public class…
1
vote
1 answer

Sharing files between apps on Android. Is there any good alternatives to ContentProvider?

I'm looking for a way to share files between apps running in the following scenario: In our app, there is a list of files. The user clicks the Share button, and we show him the selection dialog that displays list of apps that can take the file. For…
Dmitry Ratty
  • 425
  • 1
  • 10
  • 13
1
vote
1 answer

Sharing from snapchat to my app

I am unable to figure out how to share a video from SnapChat to my app while WhatsApp can do it without problems so it is possible. Since SnapChat works with a contentprovider I figured I should just query the uri using the android contentresolver…
CantThinkOfAnything
  • 1,129
  • 1
  • 15
  • 40
1
vote
0 answers

Huge delay between ContentProvider and CursorLoader

I am using a a CursorLoader and ContentProvider to read data from SQLite DB. The 'drugs' table has about 300,000 rows. I have created index on 'name' column in the 'drugs' table. I have a SearchFragment where I search for drugs based on user query…
kargirwar
  • 536
  • 2
  • 7
  • 19
1
vote
0 answers

Android what does this columns from content provider suggests?

what does new and is_read suggests in the call logs we got from content provider I was not able to understand the docs. It seems both are same. and my data is type:3 that is missed call type and it has is_read is 1 and for others is_read is null.…
santhosh
  • 1,919
  • 3
  • 21
  • 33
1
vote
0 answers

Android Content Provider, weird URI : NumberFormatException: invalid long :

I have another error with an uri when I want to update a line, I get this error below when I use : long id = ContentUris.parseId(uri); My error : 01-05 07:11:18.091 32144-32144/com.example.jean.cartememoire E/AndroidRuntime: FATAL EXCEPTION:…
Zul Huky
  • 331
  • 4
  • 24
1
vote
0 answers

Cursor Loader Data not getting refreshed

I am using a CursorLoader with ContentProvider to fetch the data into a cursor. As far as I know, the cursor loader registers a Content Observer, so whenever the underlying data changes for the cursor, the loader's onLoadFinished should be…
Ayush
  • 51
  • 1
  • 4
1
vote
1 answer

android SQLite, can't view data anymore in my listView

Yesterday I made a nice listView to see my database, but today I tried to add on line to my database and I got an error message saying something like "Database leaked. blabla close your database". After that I could not add anymore line to my…
Zul Huky
  • 331
  • 4
  • 24
1
vote
4 answers

Deleting Only One Row in SQLite Using ContentProvider

I'm trying to delete only one row from an SQLite database using a content provider, but my code deletes all rows. Here is what I'm doing: I'm passing this uri: content://appfactory.app.dehleezcafe/category/1 Where the "category" is the table name…
fullmoon
  • 8,030
  • 5
  • 43
  • 58
1
vote
2 answers

FileObserver not working on Android 6, alternative to detect screenshots on Android

I am trying to detect screenshots on Android app using fileObserver, fileObserver does not work on Android 6 as expected. Here is the snippet which detects the screenshot: @Override protected void onCreate(Bundle savedInstanceState) { …
user7365614
  • 469
  • 2
  • 4
  • 14
1
vote
1 answer

Android Contente provider error : " java.lang.IllegalArgumentException: column 'theme' does not exist"

I have an error when I try to use a ListAdapter to read my database in a Fragment Class. I feel like this isn't a hard error to resolve and there is not much code to check but I don't know why I get this error : "java.lang.IllegalArgumentException:…
Zul Huky
  • 331
  • 4
  • 24
1
vote
1 answer

Improper Neutralization of Special Elements used in an SQL Command

My App data managed by the Content Provider using CursorLoaders is in SQLite database. According to Veracode Static Scan report , it is prone to SQL Injections. But according to docs, To avoid this problem, use a selection clause that uses ? as a…