MIME Type Reference

  Content providers can return standard MIME media types, or custom MIME type strings, or both.

  provider支持标准MIME和自定义的MIME

  MIME types have the format 标准MIME格式如下:

  type/subtype

  For example, the well-known MIME type text/html has the text type and the html subtype. If the provider returns this type for a URI, it means that a query using that URI will return text containing HTML tags.

  Custom MIME type strings, also called "vendor-specific" MIME types, have more complex type and subtype values. The type value is always

 自定义的MIME基类型总是下面两个:而子类型是自定义的。
  • vnd.android.cursor.dir for multiple rows,
  • vnd.android.cursor.item for a single row.

  The subtype is provider-specific. The Android built-in providers usually have a simple subtype. For example, when the Contacts application creates a row for a telephone number, it sets the following MIME type in the row:

  举例:
  vnd.android.cursor.item/phone_v2

  Notice that the subtype value is simply phone_v2.

  Other provider developers may create their own pattern of subtypes based on the provider's authority and table names. For example, consider a provider that contains train timetables. The provider's authority is com.example.trains, and it contains the tables Line1, Line2, and Line3.

In response to the content URI  for table Line1:

content://com.example.trains/Line1

the provider returns the MIME type

vnd.android.cursor.dir/vnd.example.line1

In response to the content URI  for row 5 in table Line2:

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

the provider returns the MIME type

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

  

  Most content providers define contract class constants for the MIME types they use. The Contacts Provider contract class ContactsContract.RawContacts, for example, defines the constant CONTENT_ITEM_TYPE for the MIME type of a single raw contact row.

  Content URIs for single rows are described in the section Content URIs.

ContentProvider官方教程(8)自定义MIME的更多相关文章

  1. ContentProvider官方教程(9)定义一个provider完整示例:实现方法,定义权限等

    Creating a Content Provider In this document Designing Data Storage Designing Content URIs Implement ...

  2. ContentProvider官方教程(10)<provider>元素及属性介绍

    The <provider> Element Like Activity and Service components, a subclass of ContentProvider mus ...

  3. ContentProvider官方教程(7)3种访问形式:批处理、异步访问、intent间接访问(临时URI权限)

    Alternative Forms of Provider Access Three alternative forms of provider access are important in app ...

  4. ContentProvider官方教程(6)provider支持的数据类型

    Provider Data Types Content providers can offer many different data types. The User Dictionary Provi ...

  5. ContentProvider官方教程(5)ContentResolver插入、更新、删除 示例

    Inserting, Updating, and Deleting Data In the same way that you retrieve data from a provider, you a ...

  6. ContentProvider官方教程(2)简介、Content URIs

    In this document Overview Accessing a provider Content URIs Content Provider Basics A content provid ...

  7. ContentProvider官方教程(1)何时用content provider

    Content Providers Content providers manage access to a structured set of data. They encapsulate the ...

  8. 自定义View(7)官方教程:自定义View(含onMeasure),自定义一个Layout(混合组件),重写一个现有组件

    Custom Components In this document The Basic Approach Fully Customized Components Compound Controls ...

  9. ActionBar官方教程(11)自定义ActionBar的样式(含重要的样式属性表及练习示例)

    Styling the Action Bar If you want to implement a visual design that represents your app's brand, th ...

随机推荐

  1. C++之路进阶——codevs1204(寻找子串位置)

    1204 寻找子串位置  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 青铜 Bronze     题目描述 Description 给出字符串a和字符串b,保证b是a的一个子 ...

  2. paper 65 :尺度不变特征变换匹配算法[转载]

    尺度不变特征变换匹配算法 对于初学者,从David G.Lowe的论文到实现,有许多鸿沟,本文帮你跨越.1.SIFT综述 尺度不变特征转换(Scale-invariant feature transf ...

  3. linux中的一个看图的软件

    毕竟才是初入linux,很多工具,先要要求有个用着,之后再要求小巧强大好用. 看图软件,不喜欢kde或者是gnome这种庞大的桌面环境,也就不喜欢一些跟特定桌面环境沾边的软件(总觉得用软件必须要用特定 ...

  4. Java高效编程之二【对所有对象都通用的方法】

    对于所有对象都通用的方法,即Object类的所有非final方法(equals.hashCode.toString.clone和finalize)都有明确的通用约定,都是为了要被改写(override ...

  5. 【sinatra】结合Padrino framework

    用Sinatra来做复杂的Web应用时,会出现若干个比较麻烦的点. 要手工作成一个个的应用骨架.作成test .view.public目录等等 将Sinatra DSL集中在一个类中的话,画面数量增加 ...

  6. 【py】安装ipython-notebook

    os:ubunutu(debian)-based linux 分两步: 安装ipython及其依赖包 sudo apt-get install ipython-notebook   安装可选的附加工具 ...

  7. Mysql 的存储引擎,myisam和innodb的区别

    MyISAM 是非事务的存储引擎,innodb是支持事务的存储引擎. innodb的引擎比较适合于插入和更新操作比较多的应用,而MyISAM 则适合用于频繁查询的应用 . MyISAM --表锁,in ...

  8. 【转】C#访问权限修饰符

    C#访问权限修饰符 C#中类及类型成员修饰符有以下四类:public,private,protected,internal. public        类及类型成员的修饰符 private 类型成员 ...

  9. django migrate10060 Duplicate column name错误

    这个错误意思是有重复的列名,其实大部分原因是因为某些列被执行了多次,可以打开migration里面的django生成的文件去排查错误,然后自己手动修改数据库还原,实在不行可以把除了0001和init文 ...

  10. linux 下某个文字在某几行的shell 写法 。

    cat -n  139.sql |grep "kkkn"  sed -n '697804,697812p' 139.sql