我制作了一个保存系统,在其中保存图片,然后关闭应用程序,然后找到文件夹。我想打开图片,但是图片打开很慢。当我重置电话三星银河 w 时,这张图片打开得非常快(1 秒)。我的代码有什么问题?
private String mImagePath = Environment.getExternalStorageDirectory() + "/anppp";
private File file;
public void save() {
File dirPath = new File(Environment.getExternalStorageDirectory().toString() + "/anppp");
dirPath.mkdirs();
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat formatter= new SimpleDateFormat("yyyyMMMddHmmss");
String dateNow = formatter.format(currentDate.getTime());
file = new File(mImagePath + "/"+"ProPaint-" + dateNow +".jpg");
FileOutputStream fos=null;
try {
if(!file.exists())
file.createNewFile();
fos = new FileOutputStream(file);
mBitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.close();
} catch (FileNotFoundException e) {
Log.e("Panel", "FileNotFoundException", e);
} catch (IOException e) {
Log.e("Panel", "IOEception", e);
}
}