本文整理匯總了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);
}