android - ContentProvider 内部是如何工作的

标签 android android-contentprovider

大家,我在看android源码。但是我找不到对我有值(value)的东西。实际上,我想知道ContentProvider是否像AIDL一样工作。你知道,AIDL可以实现两个独立应用程序之间的通信。

所以,我只想看看 ContentProvider 在内部是如何工作的。

最佳答案

来自 ContentProvider Source code

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 android.database.sqlite.SQLiteDatabase.

根据这个和我发送给您的链接中的信息,ContentProvider 没有使用 AIDL...它使用的是 ContentResolver 接口(interface)。

关于android - ContentProvider 内部是如何工作的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13116994/

相关文章:

java - ManagedQuery 始终返回相同的结果

android - 如何将 ListView 构建器与 Provider 一起使用?

Android ContentProvider读写权限

android - 如何更好地将数据从 BroadcastReceiver 发送到 Activity?

java - fragment .java 错误 : No suitable method in found and cannot resolve method 'inflate(int, boolean)'

Android Studio 无法解析 org.jetbrains.kotlin :kotlin-gradle-plugin:1. 7.10

android - 拥有行 uri 后从内容提供者获取数据的正确方法是什么?

c# - 如何在 xamarin.forms pcl 项目中配置 map ?

android - cardview kotlin 的 Layoutparams 未解决

android - 拥有带有 SQLite 和多个表的 ContentProvider