效果如图,解决intent传递信息过大问题:
!!! FAILED BINDER TRANSACTION !!! (parcel size = ***)
高斯模糊引用: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;
}
来源:CSDN
作者:极北之森
链接:https://blog.csdn.net/qq_35411663/article/details/104417720