android-contentprovider

Does Android Content Provider authority definition break the DRY rule?

夙愿已清 提交于 2020-01-01 17:13:38
问题 Android's Content Provider must have: At least one authority must be specified. So for example in Google's samples android-BasicSyncAdapter AndroidManifest.xml there is <provider android:name=".provider.FeedProvider" android:authorities="com.example.android.basicsyncadapter" android:exported="false" /> Then to implement this CP one need to define the same String inside the CP like in android-BasicSyncAdapter FeedProvider.java CONTENT_AUTHORITY public static final String CONTENT_AUTHORITY =

Does Android Content Provider authority definition break the DRY rule?

99封情书 提交于 2020-01-01 17:13:15
问题 Android's Content Provider must have: At least one authority must be specified. So for example in Google's samples android-BasicSyncAdapter AndroidManifest.xml there is <provider android:name=".provider.FeedProvider" android:authorities="com.example.android.basicsyncadapter" android:exported="false" /> Then to implement this CP one need to define the same String inside the CP like in android-BasicSyncAdapter FeedProvider.java CONTENT_AUTHORITY public static final String CONTENT_AUTHORITY =

Use Android Contacts app to edit a raw contact which was added by a custom ContentProvider

喜夏-厌秋 提交于 2020-01-01 16:59:17
问题 My app adds contact ' Bob ' to the address book using a custom ContentProvider . In the Android Contacts app, Bob shows up just as any other (Google) contact. But when I edit Bob in the Contacts app, the data provided by my application is not editable. So far so good. My question is : From within my app, is there a way to fire up the Contacts app, in a way that allows the user to edit the portion of Bob that belongs to my app? I have tried to use the corresponding Intent , as described in

What is the URI for SMS Draft Content Provider?

允我心安 提交于 2020-01-01 12:06:54
问题 What is the Native Content URI for SMS Drafts? 回答1: Content Provider URI for SMS is commonly content://sms/... and for SMS Drafts it is content://sms/drafts/ 回答2: You can open each SMS message part by opening different ways. Inbox = "content://sms/inbox" Failed = "content://sms/failed" Queued = "content://sms/queued" Sent = "content://sms/sent" Draft = "content://sms/draft" Outbox = "content://sms/outbox" Undelivered = "content://sms/undelivered" All = "content://sms/all" Conversations =

What is the URI for SMS Draft Content Provider?

北城以北 提交于 2020-01-01 12:06:45
问题 What is the Native Content URI for SMS Drafts? 回答1: Content Provider URI for SMS is commonly content://sms/... and for SMS Drafts it is content://sms/drafts/ 回答2: You can open each SMS message part by opening different ways. Inbox = "content://sms/inbox" Failed = "content://sms/failed" Queued = "content://sms/queued" Sent = "content://sms/sent" Draft = "content://sms/draft" Outbox = "content://sms/outbox" Undelivered = "content://sms/undelivered" All = "content://sms/all" Conversations =

ContentObserver on content://sms/ in 1.6+?

北城以北 提交于 2020-01-01 10:13:56
问题 I have a content observer that polls content://sms/ in android 1.5 so that I get notified of changes in the sms database and can react to them accordingly. However in 1.6 this doesn't work, has the uri been changed from content://sms/ to something else? I have seen content://mms-sms/ popping up in the logcat on my 1.6 device but I have tried that and it doesn't work. Here is my code String url = "content://sms/"; Uri uri = Uri.parse(url); getContentResolver().registerContentObserver(uri, true

UnsupportedOperationException while calling getSharedPreferences() from unit test

荒凉一梦 提交于 2019-12-31 22:38:11
问题 I've implemented Content Provider that retrieves data from a service installed on network. The content provider takes required parameters from shared preferences (user credentials, app name, etc.) SharedPreferences settings = getContext().getSharedPreferences(NET_PREFS, 0); I use unit test for this Content provider: public class ResearchProviderTest extends ProviderTestCase2<MyProvider>{ public ResearchProviderTest() { super(MyProvider.class, MyProvider.CONTENT_AUTHORITY); } public void

SimpleCursorAdapter's old constructor deprecated.. really?

柔情痞子 提交于 2019-12-31 22:24:12
问题 Here it says that SimpleCursorAdapter 's API level 1 constructor is deprecated and the use of LoaderManager and CursorLoader is recommended. But delving into the LoaderManager and CursorLoader 's use I found this example where inside an inner class that extends a ListFragment (an extension of Fragment itself I suppose) we create a CursorLoader . Everything seems ok, except for the fact that CursorLoader takes a Uri as an argument. So this implies that I need to create a ContentProvider to get

How to address multiple content providers?

偶尔善良 提交于 2019-12-31 12:52:19
问题 I created two content providers that work on two different tables of the same SQLite database. They share a single instance of SQLiteOpenHelper as described in the post of Ali Serghini. Each content provider is registered in AndroidManifest.xml as follows. <provider android:name=".contentprovider.PostsContentProvider" android:authorities="com.example.myapp.provider" android:exported="false" android:multiprocess="true" > </provider> <provider android:name=".contentprovider

How to address multiple content providers?

最后都变了- 提交于 2019-12-31 12:50:00
问题 I created two content providers that work on two different tables of the same SQLite database. They share a single instance of SQLiteOpenHelper as described in the post of Ali Serghini. Each content provider is registered in AndroidManifest.xml as follows. <provider android:name=".contentprovider.PostsContentProvider" android:authorities="com.example.myapp.provider" android:exported="false" android:multiprocess="true" > </provider> <provider android:name=".contentprovider