In my Application, i need to download the image from server and save it in SDcard. I am using Volley library to download the image from server. Issue in my Application is when i am downloading the image from server it is 30kb and after downloaded checking the size of that image in SDcard was 200kb.
This is my SavedSDcard()
which is used to save the image in SDcard and returning the ImagePath.
public String SavedInSDCard(Bitmap bitmap_in, String id) {
File dir = new File(ApplicationController.getInstance()
.getExternalFilesDir("MyApplicationName") + "/Cache");
// Create the storage directory if it does not exist
if (!dir.exists()) {
dir.mkdirs();
}
File file = new File(dir, id);
try {
FileOutputStream out = new FileOutputStream(file);
bitmap_in.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
} catch (Exception e) {
e.printStackTrace();
}
String imgPath = dir + "/" + id;
return imgPath;
}