I am creating image programmatically and then pull that image from device to pc and open the that image then unable to view that image and getting message that Can’t open this image because this picture is being edited in another program
here is the code
View content = findViewById(R.id.myview);
content.setDrawingCacheEnabled(true);
content.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH);
Bitmap bitmap = content.getDrawingCache();
String path = Environment.getExternalStorageDirectory().getAbsolutePath();
File file = new File(path+"/test.png");
try {
file.createNewFile();
FileOutputStream ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.PNG, 100, ostream);
ostream.close();
Toast.makeText(getApplicationContext(), "image saved", 5000).show();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(), "error", 5000).show();
}
Am I missing to close the file or anything else after saving the Image into the sdcard?
Edit:
I know the answer as given in this post but is any another way without closing the eclipse?
May be the problem with the older version of eclipse or ADT, after updating the eclipse Indigo to Juno and using with the latest ADT it will work without any error. One of the comment was given by
Draxwith new Version of ADT it solve it. I thing somewhere the was in used and not closed even though your application can free all the object free from the memory.Just update your eclipse and ADT to prevent this problem.