ContentProvider官方教程(8)自定义MIME
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的更多相关文章
- ContentProvider官方教程(9)定义一个provider完整示例:实现方法,定义权限等
Creating a Content Provider In this document Designing Data Storage Designing Content URIs Implement ...
- ContentProvider官方教程(10)<provider>元素及属性介绍
The <provider> Element Like Activity and Service components, a subclass of ContentProvider mus ...
- ContentProvider官方教程(7)3种访问形式:批处理、异步访问、intent间接访问(临时URI权限)
Alternative Forms of Provider Access Three alternative forms of provider access are important in app ...
- ContentProvider官方教程(6)provider支持的数据类型
Provider Data Types Content providers can offer many different data types. The User Dictionary Provi ...
- ContentProvider官方教程(5)ContentResolver插入、更新、删除 示例
Inserting, Updating, and Deleting Data In the same way that you retrieve data from a provider, you a ...
- ContentProvider官方教程(2)简介、Content URIs
In this document Overview Accessing a provider Content URIs Content Provider Basics A content provid ...
- ContentProvider官方教程(1)何时用content provider
Content Providers Content providers manage access to a structured set of data. They encapsulate the ...
- 自定义View(7)官方教程:自定义View(含onMeasure),自定义一个Layout(混合组件),重写一个现有组件
Custom Components In this document The Basic Approach Fully Customized Components Compound Controls ...
- ActionBar官方教程(11)自定义ActionBar的样式(含重要的样式属性表及练习示例)
Styling the Action Bar If you want to implement a visual design that represents your app's brand, th ...
随机推荐
- hdu5322 Hope
设dp[n]为n个数字排列时候的答案,那么可以得到dp方程 dp[n]=Σdp[n-i]*c(n-1,i-1)*(i-1)!*i^2(1<=i<=n) 然后上式可以化成卷积形式,分治FFT ...
- springday03-go1
springday02项目下新建包annotation11.复制xml文件到包annotation1下,并添加组件扫描方式代码2.Waiter类实现序列化接口,构造函数,并使用特定注解标记waiter ...
- TP隐藏入口
我们知道,在thinkphp的案例中有一个.htaccess文件,里面配置了URL的一些重写规则,如: <IfModule mod_rewrite.c> RewriteEngine on ...
- 当执行php脚本时用户关闭浏览器会发生什么?
2008年8月16日 1,152 views 发表评论 阅读评论 如果一段php脚本执行插入数据到mysql的操作. 一般情况下,由于php脚本在服务器上执行,此时用户虽然关闭了浏览器,但是服务器端的 ...
- 关于DISTINCE的用法
SQL SELECT DISTINCT 语句 在表中,可能会包含重复值.这并不成问题,不过,有时您也许希望仅仅列出不同(distinct)的值. 关键词 DISTINCT 用于返回唯一不同的值. 语法 ...
- paper 44 :颜色矩和颜色相关图(color correlogram)
- 夺命雷公狗---DEDECMS----32dedecms电影网评价星星功能的实现
我们要完成的是电影网的评价功能: 我们要做这个功能前,就要让前期工作准备好,首先让鼠标移动到星星时,星星的左边都是黄色的星星右边还是灰星星. 我们打开内容页的模版看下他代码是如何组成的: 我们在这里可 ...
- decimal.tostring()格式
nt/Decimal.ToString 方法 (String, IFormatProvider) decimal value = 16325.62m; string specifier; Cult ...
- window7快捷键
新建文件夹:Shift +F10 松手 shift + w 两遍 Enter shift+F Enter
- linux设备驱动归纳总结(四):1.进程管理的相关概念【转】
本文转载自;http://blog.chinaunix.net/uid-25014876-id-64866.html linux设备驱动归纳总结(四):1.进程管理的相关概念 xxxxxxxxxxxx ...