保存bitmap 图片路径

 public void saveimg(){
        Bitmap mSignBitmap;
        mSignBitmap =(Bitmap)mView.getCachebBitmap();
//        String savePath="/sdcard/a.jpg";
        String sign_dir = Environment.getExternalStorageDirectory() + File.separator;
        savePath = sign_dir + System.currentTimeMillis() + ".png";
        File f = new File(savePath);
        FileOutputStream fOut = null;
        try {
            fOut = new FileOutputStream(f);
            mSignBitmap.compress(Bitmap.CompressFormat.JPEG,100, fOut);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }finally{
            try {
                fOut.flush();
                fOut.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }

安卓开发交流群 : 595856941

你可能感兴趣的:(工具类相关)