android Bitmap保存到文件(PNG)

来源:互联网 发布:手机淘宝网2016 编辑:程序博客网 时间:2024/05/22 04:58
    private void saveMyBitmap(String bitName,Bitmap mBitmap){    File f = new File(DB_PATH + bitName + ".png");    try {    f.createNewFile();    } catch (IOException e) {    }    FileOutputStream fOut = null;    try {    fOut = new FileOutputStream(f);    } catch (FileNotFoundException e) {    e.printStackTrace();    }    mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);    try {    fOut.flush();    } catch (IOException e) {    e.printStackTrace();    }    try {    fOut.close();    } catch (IOException e) {    e.printStackTrace();    }    }
0 0
原创粉丝点击