public static boolean storeImage(Bitmap imageData, String filename,
String iconStoragepath) {
File sdIconStorageDir = new File(iconStoragepath);
sdIconStorageDir.mkdirs();
try {
String filePath = sdIconStorageDir.toString() + "/" + filename;
FileOutputStream fileOutputStream = new FileOutputStream(filePath);
BufferedOutputStream bos = new BufferedOutputStream(
fileOutputStream);
imageData.compress(CompressFormat.PNG, 90, bos);
bos.flush();
bos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
}
String iconStoragepath) {
File sdIconStorageDir = new File(iconStoragepath);
sdIconStorageDir.mkdirs();
try {
String filePath = sdIconStorageDir.toString() + "/" + filename;
FileOutputStream fileOutputStream = new FileOutputStream(filePath);
BufferedOutputStream bos = new BufferedOutputStream(
fileOutputStream);
imageData.compress(CompressFormat.PNG, 90, bos);
bos.flush();
bos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
} catch (IOException e) {
e.printStackTrace();
return false;
}
return true;
}
No comments:
Post a Comment