调用扫描界面 ~~~ Intent intent = new Intent(); intent.setClass(getActivity(), MipcaActivityCapture.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivityForResult(intent, SCANNIN_GREQUEST_CODE); ~~~ 扫描完成处理结果 ~~~ public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case SCANNIN_GREQUEST_CODE: if (resultCode == 520) { Bundle bundle = data.getExtras(); // 显示扫描到的内容 mapCode = IndustryDP.getQCode(bundle.getString("result")); if (!mapCode.isEmpty()) { // Log.e("domain", mapCode.get("domain")); // 获取网站地址和扫描结果对比 String s = ConfigInc.getServiceAdress(getActivity()); if (mapCode.get("domain").equals(s.substring(0, s.length() - 5))) { if (mapCode.get("is_open").equals("1")) { Intent intent = new Intent(getActivity(), ShopDetail.class); intent.putExtra("shopId", mapCode.get("shop_id").toString()); startActivity(intent); } else { Toast.makeText(getActivity(), "未发现店铺", 5000).show(); } } else { Toast.makeText(getActivity(), "未发现店铺", 5000).show(); } } else { Toast.makeText(getActivity(), "无法识别店铺", 5000).show(); } } break; } } ~~~