下面列出了java.text.SimpleDateFormat#getInstance ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Creates the image file to which the image must be saved.
*
* @return
* @throws IOException
*/
private File createImageFile() throws IOException {
SimpleDateFormat dateFormat = (SimpleDateFormat) SimpleDateFormat.getInstance();
dateFormat.applyPattern("yyyyMMdd_HHmmss");
String timeStamp = dateFormat.format(new Date());
String imageFileName = "JPEG_" + timeStamp + "_";
File storageDir = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES);
// 检测目录是否存在
if (!storageDir.exists()) {
storageDir.mkdirs();
}
File image = File.createTempFile(imageFileName, ".jpg", storageDir);
mNewImagePath = image.getAbsolutePath();
return image;
}
private static DateFormat getInstance() {
return SimpleDateFormat.getInstance();
}
public DateTimeRenderer() {
super();
dateFormatter = (SimpleDateFormat) SimpleDateFormat.getInstance();
//log.info("Simple inst");
}