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

Android 主要概念总结归纳

 2010-02-23 15:54:00 来源:WEB开发网   
核心提示:selection SQL WHERE clause.selectionArgs The arguments to selection, if any ?s are pesentsortOrder SQL ORDER BY clause.Returns* The Cursor that was returned by

selection SQL WHERE clause.

selectionArgs The arguments to selection, if any ?s are pesent

sortOrder SQL ORDER BY clause.

Returns

* The Cursor that was returned by query().

(二)更改数据

如果要成批地更新记录,调用函数ContentResolver.update(),参数为要改变的columns和values.

public final int update(Uri uri, ContentValues values, String where, String[] selectionArgs)

Update row(s) in a content URI. If the content provider supports transactions the update will be atomic.

Parameters

uri The URI to modify.

values The new field values. The key is the column name for the field. A null value will remove an existing field value.

where A filter to apply to rows before deleting, formatted as an SQL WHERE clause (excluding the WHERE itself).

Returns

* the URL of the newly created row

(三)增加记录

为了增加一个新的记录,需要调用ContentResolver.insert()方法。函数原型为:

(四)删除记录

调用ContentResolver.delete(),参数为指定的URI删除一个单一的记录。

Creating a Content Provider

下面是关于如何创建自己的content provider的方法步骤:

Here is how to create your own content provider to act as a public source for reading and

writing a new data type:

1. Extend ContentProvider.

2. Define a public static final Uri named CONTENT_URI. This is the string that represents the full "content://" URI that your content provider handles. You must define a unique string for this value; the best solution is to use the fully-qualified class name of your content provider (lowercase). So, for example:

public static final Uri CONTENT_URI = Uri.parse( "content://com.google.codelab.rssprovider");

3. Create your system for storing data. Most content providers store their data using Android's file storage methods or SQLite databases, but you can store

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

Tags:Android 主要 概念

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