WEB开发网
开发学院手机开发Android 开发 Android 主要概念总结归纳 阅读

Android 主要概念总结归纳

 2010-02-23 15:54:00 来源:WEB开发网   
核心提示:request the _data field for that record, and because it has higher permissions than a client, it should be able to access that file directly and return a read w
request the _data field for that record, and because it has higher permissions than a client, it should be able to access that file directly and return a read wrapper for that file to the client.

6. Declare public static Strings that clients can use to specify which columns to return, or to specify field values from the cursor. Carefully document the data type of each field. Remember that file fields, such as audio or bitmap fields, are typically returned as string path values

7. Return a Cursor object over a recordset in reply to a query. This means implementing the query(), update(), insert(), and delete() methods. As a courtesy, you might want to call ContentResolver.notifyChange() to notify listeners about updated information.

8. Add a tag to AndroidManifest.xml, and use its authorities attribute to define the authority part of the content type it should handle. For example, if your content type is content://com.example.autos/auto to request a list of all autos, then authorities would be com.example.autos. Set the multiprocess attribute to true if data does not need to be synchronized between multiple running versions of the content provider.

9. If you are handling a new data type, you must define a new MIME type to return for your implementation of android.ContentProvider.getType(url). This type corresponds to the content:// URI submitted to getType(), which will be one of the content types handled by the provider. The MIME type for each content type has two forms: one for a specific record, and one for multiple records. Use the Uri methods to help determine what is being requested. Here is the general format for each:

* vnd.android.cursor.item/vnd.yourcompanyname.contenttype for a single row. For example, a request for train record 122 using

content://com.example.transportationprovider/trains/122

might return the MIME type vnd.android.cursor.item/vnd.example.rail

上一页  2 3 4 5 6 7 8  下一页

Tags:Android 主要 概念

编辑录入:coldstar [复制链接] [打 印]
赞助商链接