我正在使用ZXing库创建一个二维码扫描仪。.IntentResult为空值,并且扫描仪无法正常工作...请帮助...谢谢!
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);
Toast.makeText(getActivity(), ""+result, Toast.LENGTH_SHORT).show();
if(result != null){
Toast.makeText(getActivity(), "in", Toast.LENGTH_SHORT).show();
if(result.getContents() == null){
Toast.makeText(getActivity(), "Scanning Cancelled", Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(getActivity(), result.getContents(), Toast.LENGTH_LONG).show();
}
}
else{
super.onActivityResult(requestCode,resultCode, data);
Toast.makeText(getActivity(), "out", Toast.LENGTH_SHORT).show();
}
super.onActivityResult(requestCode, resultCode, data);
}