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 ...
随机推荐
-
React Native填坑之旅--组件生命周期
这次我们来填React Native生命周期的坑.这一点非常重要,需要有一个清晰的认识.如果你了解Android或者iOS的话,你会非常熟悉我们今天要说的的内容. 基本上一个React Native的 ...
-
c++学习笔记2--constexpr,类型别名,auto
constexpr:修饰常量表达式,约定修饰对象不仅为常量,而且在编译阶段就能得到值. 与const不同的是,constexpr约束的是当事人,就是说,constexpr int *a=1;这样的语句 ...
-
C#编程
C#最完整的webservice实例 http://fyinthesky.blog.163.com/blog/static/3555251720110115227337/ C# WinForm 实践开 ...
-
sqlite数据库读写在linux下的权限问题
近期在学linux,恰巧有个php项目要做.于是配置好环境打算在linux下做. 无奈站点执行后一片空白.经过调试发现是sqlite数据库的问题. 安装sqlite扩展 apt-get install ...
-
Java GUI+mysql+分页查询
1.要求 : 创建一个学生信息管理数据库 2.实现分页查询 代码如下: a)学生实体类: /** * @author: Annie * @date:2016年6月23日 * @description: ...
-
(二分查找 拓展) leetcode 162. Find Peak Element &;&; lintcode 75. Find Peak Element
A peak element is an element that is greater than its neighbors. Given an input array nums, where nu ...
-
jquery中添加元素append,prepend,before和after方法的区别
append:在元素内部的最后面添加元素,作为子元素. prepend:在元素内部的最前面添加元素,作为子元素. before:在元素的前边,作为兄弟元素添加. after:在元素的后边,作为兄弟元素 ...
-
基于Grafana的监控数据钻取功能应用实践
互联网企业中,随着机器规模以及业务量的爆发式增长,监控数据逐渐成为一种大数据,对监控大数据的分析,包括数据采集.数据缓存.数据聚合分析.数据存储.数据展现等几个阶段.不同阶段有不同的解决方案及支撑工具 ...
-
Raspberry Config.txt 介绍
原文连接:http://elinux.org/RPi_config.txt Config.txt 由于树莓派并没有传统意义上的BIOS, 所以现在各种系统配置参数通常被存在"config.t ...
-
jq 浏览器窗口大小发生变化时
当调整浏览器窗口的大小时,发生 resize 事件: $(selector).resize(); 实例 对浏览器窗口调整大小进行计数: $(window).resize(function() { $( ...