在Fragment中点击图片调用摄像头扫描二维码中Intent出错

图片说明

public class MyFragment1 extends Fragment {

    public MyFragment1() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.myfragment1, container, false);
        ImageView saoma=(ImageView)view.findViewById(R.id.saoma);


        saoma.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(MyFragment1.this, CaptureActivity.class);

                ZxingConfig config = new ZxingConfig();
                config.setPlayBeep(true);//是否播放扫描声音 默认为true
                config.setShake(true);//是否震动  默认为true
                config.setDecodeBarCode(true);//是否扫描条形码 默认为true
                config.setReactColor(R.color.bg_white);//设置扫描框四个角的颜色 默认为白色
                config.setFrameLineColor(R.color.bg_white);//设置扫描框边框颜色 默认无色
                config.setScanLineColor(R.color.bg_white);//设置扫描线的颜色 默认白色
                config.setFullScreenScan(false);//是否全屏扫描  默认为true  设为false则只会在扫描框中扫描
                intent.putExtra(Constant.INTENT_ZXING_CONFIG, config);
                startActivity(intent);
            }
        });


        return view;

    }

}

问题已解决
https://blog.csdn.net/sinat_33921105/article/details/53967970