9.保存图片到SDCard:
- /** * @param imagePath 图片保存路径
- * @param bm 被保存的bitmap对象 */
- public static void saveImgToLocal(String imagePath, Bitmap bm) { if (bm == null || imagePath == null || "".equals(imagePath)) {
- return; }
- File f = new File(imagePath); if (f.exists()) {
- return; } else {
- try { File parentFile = f.getParentFile();
- if (!parentFile.exists()) { parentFile.mkdirs();
- } f.createNewFile();
- FileOutputStream fos; fos = new FileOutputStream(f);
- bm.compress(Bitmap.CompressFormat.PNG, 100, fos); fos.close();










