舒心、快乐,比什么都重要

BitMap存储jpg到手机sd卡中

 /**
     * 将BitMap转成Jpeg图片保存到sdcard(便于以后debug调试查看和裁切调试)
     */
    private void saveBitmap(Bitmap bitmap, String FileName) throws IOException {
        File file = new File("/sdcard/" + "1111test" + ".jpg");
        if (file.exists()) {
            file.delete();
        }
        FileOutputStream out;
        try {
            out = new FileOutputStream(file);
            if (bitmap.compress(Bitmap.CompressFormat.PNG, 90, out)) {
                out.flush();
                out.close();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            Log.d("file_save = ", "file_save_fail    FileNotFoundException !!!!!!");
        } catch (IOException e) {
            e.printStackTrace();
            Log.d("file_save = ", "file_save_fail    IOException !!!!!!");
        }
    }

 

posted @ 2016-11-03 10:46  Arcturis  阅读(325)  评论(0编辑  收藏  举报