Content Provider Example using two android applications

好久不见. 提交于 2019-12-30 14:08:15

问题


I want to insert or delete the values in another android applications database from my current android application.

I searched a lot. Everybody saying that use "content provider" its not used with two applications all used with in a application.


回答1:


here i found some examples/tutorial for you, Please have a look , below tuts include everything you can do to create content provider.

Android Fundamentals: Working With Content Providers .

example1




回答2:


Assuming that you have a database and a content provider in your application.... You can use the database of other application if it is exported. To export your database you just need to set the value of android:exported attribute of Provider tag to true in android.manifest file

    <provider
        android:exported="true"
        android:name="<content provider>"
        android:authorities="<content provider authority>" >
    </provider>

In the other application's Android.Manifest file provide the permission to access the content provider.

see the links below for more informationContent Providers and Using Content Providers



来源:https://stackoverflow.com/questions/11407798/content-provider-example-using-two-android-applications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!