I am using the Phonegap 2.20 Android Screenshot plugin and it works fine. Now I want to save the image rotated by 270° - but I am new to Java/Android and need some help:
I tried to rewrite the EXIF data as follows
...
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);
but it allways throws the error
E/JHEAD(26853): Can't write back - didn't read all
So I think I need to wait until the file is finished writing? Is there any listener or callback or s.l.t.?