I am working on a application that will stores a drawn canvas as jpeg image in SD card.
The issue is when i tried to view the saved image it is loading for lot of time than other images i want the saved image to be viewed in normal time as like other images
My code for saving an image is:
View content = drawView;
content.setDrawingCacheEnabled(true);
content.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_LOW);
Bitmap bitmap = content.getDrawingCache();
String path = Environment.getExternalStorageDirectory().getAbsolutePath();
String file_name="Imatge"+System.currentTimeMillis()+".jpg";
File file = new File(path,file_name);
FileOutputStream ostream;
try {
ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.PNG,50, ostream);
ostream.flush();
ostream.close();
Toast.makeText(getApplicationContext(), " :) Image saved in "+ path+"/"+file_name, 5000).show();
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(getApplicationContext(), e.toString()+"error", 5000).show();
}
}
Thanks in advance please help me!!!!
I myself find the solution , the solution is to store the image thru media store here is my code that is working correctly