android - Android URI 中 authority 和 scheme 的区别

标签 android uri android-contentprovider authority

Android 中URI authority 和URI scheme 有什么区别? 我总是在 URI 中使用方案来指示数据库表,如下所示:

content://scheme

我在我的应用程序中使用自定义搜索建议,我阅读了有关搜索自定义建议的文档,其中使用授权而不是方案来引用数据库,如下所示:

content://your.authority/opthional.suggest.path/SUGGEST_URI_PATH_QUERY

上面的my.authority是什么?这个和scheme有什么区别?

最佳答案

i always use scheme in uri to indicate database table as follow content://scheme

scheme不是计划。 content是方案,遵循the rules for URI values .你有什么 scheme Android content:// 是什么Uri被称为权威。

what is my.authoruty above ?

是权威。它需要在 android:authorities<provider> 的属性在您的 list 中,Android 使用它来找到一个真正的 ContentProvider对于任何 Uri .

what is the difference between this and scheme ?

它们是相同的,因为您误用了“方案”一词。

关于android - Android URI 中 authority 和 scheme 的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30710046/

相关文章:

java - 自定义SeekBar : set min value

android - 如何在调用/接听电话时以编程方式打开扬声器?

java - 位图到uri转换android

使用 Cobra 进行 Java HTML 渲染

android - 内容提供者中的生命周期/流量控制?

android - xamarin 5.7 android 连接到布局渲染器失败

java - Android BaseAdapter.notifyDataSetChanged() 不刷新 View

android - 从 Uri 到 Path 再回到 Uri

android - 如何将自己的ContentProvider用于其他应用程序?

android - 如何为android中的所有联系人创建一个.vcf文件