Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content Provider 学习 #7

Open
erichua23 opened this issue Mar 22, 2013 · 0 comments
Open

Content Provider 学习 #7

erichua23 opened this issue Mar 22, 2013 · 0 comments

Comments

@erichua23
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant