Skip to content

Content Provider 学习 #7

@erichua23

Description

@erichua23
mNewUri  = getContentResolver().insert(
    UserDictionary.Word.CONTENT_URI,   // the user dictionary content URI
    mNewValues  
)

mNewUri 为Uri
mNewUri 格式为: content://user_dictionary/words/<id_value> <id_value>是刚插入行的_ID

getContentResolver().update(
    UserDictionary.Words.CONTENT_URI,   // the user dictionary content URI
    mUpdateValues                       // the columns to update
    mSelectionClause                    // the column to select on
    mSelectionArgs                      // the value to compare to
);

返回值为更新记录数

 getContentResolver().delete(
    UserDictionary.Words.CONTENT_URI,   // the user dictionary content URI
    mSelectionClause                    // the column to select on
    mSelectionArgs                      // the value to compare to
);

同样返回删除记录数

Providers also maintain MIME data type information for each content URI they define. \You can use the MIME type information to find out if your application can handle data that the provider offers, or to choose a type of handling based on the MIME type.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions