为什么此自定义 MIME 类型的子类型不指定 table 中的特定行(来自 Content URI)?

Why doesn't the subtype of this custom MIME type specify the particular row (from Content URI) in the table?

the developer guide 的末尾,他们将 vnd.android.cursor.dir 描述为每个自定义 MIME 类型的 type 部分,用于多行; vnd.android.cursor.item 一行。

然后是包含列车时间tables 的Content Provider 示例。它的 authoritycom.example.trains 并且它有 tables Line1Line2Line3。对于它的内容 URI

content://com.example.trains/Line2/5

显然指向“Line2 table 中的第 5 行”,返回的 MIME 类型将是:

vnd.android.cursor.item/vnd.example.line2

不表示是哪一行

问题:

  1. 我觉得应该是这样的:

    vnd.android.cursor.item/vnd.example.line2.5
    

    因为 type 部分确实描述了它是特定行的 MIME 类型,所以子类型也应该描述它是哪一行 是。不是吗

  2. 如果 vnd.android.cursor.item/vnd.example.line2 是正确的,那么这意味着 MIME 类型是否属于特定行并不重要。 这是否意味着 table 中的所有行都具有相同的 MIME 类型? 因为 MIME 类型只是 Internet 上文件的类型。 (Reference) 所以我认为因为所有行都具有相同的 "types" 数据(或者换句话说 table 中的行是同一事物的有点实例) - 所以我认为table 中的所有行本质上应该具有相同的 MIME 类型?

  3. 如果 ^ 是,那么将 分类为 vnd.android.cursor.dirvnd.android.cursor.item 有什么意义?

I think it should be something like:

vnd.android.cursor.item/vnd.example.line2.5

because the type part does describe that it is the MIME type for a particular row, so the subtype should also describe which row it is. Isn't it?

不,该网页的 MIME 类型不过是 text/html.30821182,因为恰好是该网站上的问题 #30821182。 Android 中的 MIME 类型表示数据 格式.

Does it mean all the rows in a table have the same MIME type?

在该提供商中,是的。

Because a MIME type is simply the type of files on the internet.

Android 将 MIME 类型的定义扩展为比文件更通用。对于 ContentProvider 的数据库样式 API,MIME 类型主要用于 link Uri 和 activity 的数据结构可以使用该数据结构。

I think all rows in a table should inherently have the same MIME type?

这是数据库样式的典型模式 ContentProvider API。

then what is the point of having the categorization into the vnd.android.cursor.dir and vnd.android.cursor.item ?

前者表示内容集合,您可以将其视为 table 或 SQL 数据库中的视图。后者代表一个内容实例,您可以将其视为 table 中的一行或 SQL 数据库中的视图。