除了这个方法外,Content Provider Media API的公共方法对我来说看起来非常直接。我不确定这个方法是做什么或如何使用它。如果有关于使用方法的任何见解,将不胜感激。
INTERNAL_CONTENT_URI
,使用 "external" 表示 EXTERNAL_CONTENT_URI
,这是根据源代码显示的。 /**
* Get the content:// style URI for the image media table on the
* given volume.
*
* @param volumeName the name of the volume to get the URI for
* @return the URI to the image media table on the given volume
*/
public static Uri getContentUri(String volumeName) {
return Uri.parse(CONTENT_AUTHORITY_SLASH + volumeName +
"/images/media");
}
/**
* The content:// style URI for the internal storage.
*/
public static final Uri INTERNAL_CONTENT_URI =
getContentUri("internal");
/**
* The content:// style URI for the "primary" external storage
* volume.
*/
public static final Uri EXTERNAL_CONTENT_URI =
getContentUri("external");
CONTENT_AUTHORITY_SLASH
和 content://media/
一样好用。
public static final String AUTHORITY = "media";
private static final String CONTENT_AUTHORITY_SLASH = "content://" + AUTHORITY + "/";
volumeName
是指您的SD卡上的目录名称吗? - Azurespot我认为音量名称 "external"
和 "internal"
分别用于指代媒体的外部(sdcard)和内部位置。每个 Media
子容器都有这些音量名。
它们还具有内部和外部URI的静态常量,这可能比使用 getContentUri(volumeName)
更可取。
即,我认为(但我没有验证)
MediaStore.Images.Media.getContentUri("external").equals(MediaStore.Images.Media.EXTERNAL_CONTENT_URI)