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. HDU 4898 The Revenge of the Princess’ Knight(后缀数组+二分+暴力)(2014 Multi-University Training Contest 4)

    Problem Description There is an old country and the king fell in love with a devil. The devil always ...

  2. struts配置通配符*来匹配方法,实现动态调用

    01:web.xml中配置,启动struts2 <?xml version="1.0" encoding="UTF-8"?> <web-app ...

  3. PHP漏洞全解(详细介绍)

    转载  http://www.jb51.net/article/31898.htm 针对PHP的网站主要存在下面几种攻击方式: 1.命令注入(Command Injection) 2.eval注入(E ...

  4. css3颜色渐变

    从上到下的线性渐变: #grad {  background: -webkit-linear-gradient(red, blue); /* Safari 5.1 - 6.0 */  backgrou ...

  5. 使用node-webkit开发exe窗口程序

    首发:个人博客,更新&纠错&回复 ====关于原生程序与壳中程序的议论begin==== 在所有用户windows机器上都能直接跑的程序,如果不采用微软系的语言,如VB,C++,C#等 ...

  6. ueditor .NET版本提示uploader、Config类同时存在于两个dll中

    在网上查看了下,主要有两种解决办法 1.直接删除,以下引用. <%@ Assembly Src="Uploader.cs" %><%@ Assembly Src= ...

  7. java对象的序列化与反序列化使用

    1.Java序列化与反序列化  Java序列化是指把Java对象转换为字节序列的过程:而Java反序列化是指把字节序列恢复为Java对象的过程. 2.为什么需要序列化与反序列化 我们知道,当两个进程进 ...

  8. [转]Dynamics AX and Generic collections of .Net

    转自:http://blogs.msdn.com/b/emeadaxsupport/archive/2009/04/23/dynamics-ax-and-generic-collections-of- ...

  9. javascript || and &&

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  10. maven在windows环境下加载settings.xml文件

    今天发现maven在windows环境下加载的settings.xml文件是c:下的,就算修改conf下的settings.xml里的<localRepository>给他明确指向也没用.