Android 高斯模糊上一界面

效果如图,解决intent传递信息过大问题:
!!! FAILED BINDER TRANSACTION !!! (parcel size = ***)
Android 高斯模糊上一界面_第1张图片
Android 高斯模糊上一界面_第2张图片
高斯模糊引用:https://blog.csdn.net/blank__box/article/details/80099359

Intent intent = new Intent();
intent.setClass(getActivity(), FastBlurActivity.class);
View view = getActivity().getWindow().getDecorView();
Bitmap bmp1;
view.destroyDrawingCache();
view.setDrawingCacheEnabled(true); //防止为空
bmp1 = view.getDrawingCache();
save(bmp1); //存储图像
startActivity(intent);
public void save(Bitmap bmp1) {
        String FILENAME = "Bitm.png";
        FileOutputStream fos = null;
        try {
            fos = getActivity().openFileOutput(FILENAME, Context.MODE_PRIVATE);
            bmp1.compress(Bitmap.CompressFormat.JPEG, 100, fos);
            fos.close();

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }

另一个界面接受图像

public Bitmap readlv() {
        Bitmap bmp = null;
        try {
            FileInputStream fin = openFileInput("Bitm.png");
            bmp = BitmapFactory.decodeStream(fin);
            fin.close();
            return bmp;
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return bmp;
    }

你可能感兴趣的:(Android)