AT the end of the developer guide, they have described vnd.android.cursor.dir
to be the type
part of every custom MIME type, for multiple rows; and vnd.android.cursor.item
for a single row.
Then there is an example of a Content Provider that contains train timetables. It's authority
is com.example.trains
and it has tables Line1
, Line2
, and Line3
. And for it's content URI
content://com.example.trains/Line2/5
which is obviously pointing to the "5th row in the Line2
table", the MIME type returned will be:
vnd.android.cursor.item/vnd.example.line2
which does not indicate which row it is.
QUESTIONS:
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?If
vnd.android.cursor.item/vnd.example.line2
is correct, then that means it does not matter if the MIME type is of a particular row. 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. (Reference) So I think since all the rows have the same "types" of data (or in other words the rows in a table are kinda instances of the same thing) - so I think all rows in a table should inherently have the same MIME type?If ^ is YES, then what is the point of having the categorization into the
vnd.android.cursor.dir
andvnd.android.cursor.item
?
No, no more than the MIME type for this Web page is
text/html.30821182
because it happens to be question #30821182 on this Web site. MIME types in Android represent data formats.In that provider, yes.
Android stretches the definition of a MIME type to be more generic than just files. In the case of the database-style API of a
ContentProvider
, the MIME type is mostly there to link the data structure for aUri
with an activity that can work with that data structure.That is the typical pattern for the database-style
ContentProvider
API.The former represents a collection of content, what you would think of as a table or view in a SQL database. The latter represents an instance of content, what you would think of as a row in a table or view in a SQL database.