Android:ContentResolver.update() 究竟做了什么?

Xan*_*der 5 android android-contentresolver android-sqlite

我想使用ContentResolver.update(Uri uri, ContentValues values, String where, String[] selectionArgs) 我知道如何使用它的方法,但我想知道它对 ContentValues 做了什么。它是覆盖所有现有的 ContentValues,还是只覆盖给定的 ContentValues?

例如,这些 ContentValues 存在:

A: abc
B: 123
C: 456
Run Code Online (Sandbox Code Playgroud)

update()方法中的 ContentValues包含以下内容:

A: asdf
C: 789
Run Code Online (Sandbox Code Playgroud)

那么新的 ContentValues 将是:(仅覆盖给定的值)

A: asdf
B: 123
C: 789
Run Code Online (Sandbox Code Playgroud)

或者会是:(覆盖所有值)

A: asdf
C: 789
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

 contentResolver.update(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, values, "_data=" + audioFilePath, null);
Run Code Online (Sandbox Code Playgroud)

其中values包含ContentValues应该被覆盖的 并且audioFilePath包含音频文件的路径(这是 的值_data)。

Sin*_*ese 3

它只会覆盖给定的 ContentValues。