二维码中间生成的图片我用的是minpmap里面的图片logo:
Bitmap logo = BitmapFactory.decodeResource(context.getResources(), R.drawable.logo);
Bitmap bm = QRCodeUtil.createQRImage(context,text, logo);
public static Bitmap createQRImage(Context context, String content, Bitmap logo) {
Matrix m = new Matrix();
float sx = (float) 2 * IMAGE_HALFWIDTH / logo.getWidth();// 这里报错!android9.0报错!!NullpointException
float sy = (float) 2 * IMAGE_HALFWIDTH / logo.getHeight();
// 设置缩放信息
m.setScale(sx, sy);
....
...
我改成用drawable里面的图片就没问题,然后我再把logo复制到drawable,再用也没报错....
不知道啥问题...
...