我正在使用 Phonegap 2.20 Android Screenshot 插件,它工作正常。现在我想保存旋转 270° 的图像 - 但我是 Java/Android 新手,需要一些帮助:
我试图重写EXIF数据如下
...
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyymmddhhmmss");
String filename = "Screenshot_" + dateFormat + ".png";
File f = new File(folder, filename); // System.currentTimeMillis()
//FileOutputStream fos = openFileOutput(f.getPath(), Context.MODE_PRIVATE);
FileOutputStream fos = new FileOutputStream(f);
// change image orientation to landscape
ExifInterface exif = new ExifInterface(filename);
exif.setAttribute(ExifInterface.TAG_ORIENTATION, "8"); // ExifInterface.ORIENTATION_ROTATE_270
exif.saveAttributes();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos);
//fos.close();
//Log.w(TAG, "TAG_ORIENTATION: " + exif.getAttribute(ExifInterface.TAG_ORIENTATION));
that.success(new PluginResult(PluginResult.Status.OK), id);
但它总是抛出错误
E/JHEAD(26853):无法回写 - 未全部读取
所以我想我需要等到文件写完?是否有任何侦听器或回调或 slt?