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 ...
随机推荐
- Java用native2ascii命令做unicode编码转换
背景:在做Java开发的时候,常常会出现一些乱码,或者无法正确识别或读取的文件,比如常见的validator验证用的消息资源(properties)文件就需要进行Unicode重新编码.原因是java ...
- Codeforces Round #288 (Div. 2)
A. Pasha and Pixels 题意就是给一个n*m的矩阵,k次操作,一开始矩阵全白,一次操作可以染黑一个格子,问第几次操作可以使得矩阵中存在一个2*2的黑色矩阵.直接模拟即可 代码: ...
- java 控制器向页面传值方式
1.单个字符串 @RequestMapping(value = "list", method = RequestMethod.GET) public ModelAndView li ...
- yii2顶部导航使用
yii2中使用顶部导航的具体方法: 1.视图中调用两个类: use yii\bootstrap\Nav;use yii\bootstrap\NavBar; 2. <?php ...
- jQuery基础之让出$,与其他库共存
在某些情况下,可能有必要在同一个页面中使用多个JS库,由于很多库都使用$标识符(因为他简短方便),因此就需要一种方式来避免名称冲突. 为解决这个问题,jQuery提供了一个名叫.noConflict( ...
- Android压力测试快速入门教程(图解)——Monkey工具
文章目录: 一.Monkey简介 二.Monkey的基本用法 三.Monkey测试示例图解 四.Monkey命令参数介绍 五.Monkey log分析 一.Monkey简介 Monkey:Androi ...
- ubuntu使用记录
常用指令 ls 显示文件或目录 -l 列出文件详细信息l(list) -a 列出当前目录下所有文件及目录,包括隐藏的a(all) mkdir ...
- pybot/robot命令参数说明
Robot Framework -- A generic test automation framework Version: 3.0 (Python 3.4.0 on win32) Usage: r ...
- Delphi中CoInitialize之探究
CoInitialize(LPVOID),它将以特定参数调用CoInitializeEx,为当前单元初始化COM库,并标记协同模式为单线程模式.参数必须为NULL.这是关于OLE和COM的问题. Co ...
- & jobs fg Ctrl+z bg
-l选项,jobs命令可以显示后台正在运行的任务的进程号信息: ctrl+l组合键:将放在前台的任务挂起: bg命令将挂起的任务放在后台继续运行 [xiluhua@vm-xiluhua][~]$ sl ...