本文整理汇总了Java中android.os.Environment.DIRECTORY_MOVIES属性的典型用法代码示例。如果您正苦于以下问题:Java Environment.DIRECTORY_MOVIES属性的具体用法?Java Environment.DIRECTORY_MOVIES怎么用?Java Environment.DIRECTORY_MOVIES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.os.Environment
的用法示例。
在下文中一共展示了Environment.DIRECTORY_MOVIES属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOutputMediaFile
private File getOutputMediaFile(int type) {
// Get environment directory type id from requested media type.
String environmentDirectoryType;
if (type == MEDIA_TYPE_IMAGE) {
environmentDirectoryType = Environment.DIRECTORY_PICTURES;
} else if (type == MEDIA_TYPE_VIDEO) {
environmentDirectoryType = Environment.DIRECTORY_MOVIES;
} else {
Log.e(TAG, "Unsupported media type:" + type);
return null;
}
return getOutputFile(
type,
Environment.getExternalStoragePublicDirectory(environmentDirectoryType)
);
}
示例2: createImageFile
private File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
String imageFileName = (isVideo ? "MPEG_" : "JPEG_") + timeStamp + "_";
String dirType = isVideo ? Environment.DIRECTORY_MOVIES : Environment.DIRECTORY_PICTURES;
File storageDir = isPublic ? getExternalStoragePublicDirectory(dirType) :
getExternalFilesDir(dirType);
if( !storageDir.exists() ) {
storageDir.mkdirs();
}
File image = File.createTempFile(
imageFileName,
isVideo ? ".mp4" : ".jpg",
storageDir
);
return image;
}
示例3: getVideoDir
public static File getVideoDir() throws NoExternalStorageException {
return new File(getSignalStorageDir(), Environment.DIRECTORY_MOVIES);
}