startActivityForResult给出异常

时间:2015-08-10 07:00:00

标签: android fingerprint

我是Android的新手,有人可以帮助我,以下是我试图运行扫描指纹的代码,但是每当我点击按钮时它会发出错误它会强制关闭我应该做什么帮助我。< / p>

Intent fingerPrintCaptureImageIntent = new Intent(
                        Intent.ACTION_SEND);
                fingerPrintCaptureImageIntent
                        .putExtra("source", "registration");
                // fingerPrintCaptureImageIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
                // fingerPrintCaptureImageIntent.setComponent(new
                // ComponentName("com.integratedbiometrics.SimpleScan",
                // "com.integratedbiometrics.SimpleScan.SimpleScanActivity"));
                PackageManager packageManager = getActivity()
                        .getPackageManager();
                List<ResolveInfo> activities = packageManager
                        .queryIntentActivities(fingerPrintCaptureImageIntent, 0);

                boolean isIntentSafe = activities.size() > 0;
                if (isIntentSafe) {
                    try {
                            startActivityForResult( fingerPrintCaptureImageIntent, Constants.FINGER_PRINT_REQUEST_CODE_FOR_REGISTRATION);
                    }
                    catch (Exception e) {
                        Log.d("TAG",e.getMessage());
                        e.printStackTrace();
                    }
                } else {
                    Log.i("No Such Activity Found",
                            "No Such Activity Found To Open.");
                }

onActivityResult方法是:

  if (requestCode == Constants.FINGER_PRINT_REQUEST_CODE_FOR_REGISTRATION
                && resultCode == Activity.RESULT_OK) {
            if (data.hasExtra("cancel")) {
                // do nothing ...
            } else if (data.hasExtra("file_name")) {
                String fileName = data.getStringExtra("file_name");
                ((TextView) getActivity().findViewById(
                        R.id.fingerprintTakenInfoText)).setText(fileName + "");
                if (fileName != null) {
                    try {
                        String fingerData = Utility
                                .ReadFingerDataFromExternalStorage(fileName);
                        parentActivity.registrationEntity.fingerPrints = fingerData;
                        fingerPrintDataFileName = fileName;
                        ((TextView) getActivity().findViewById(
                                R.id.fingerprintTakenInfoText))
                                .setBackgroundColor(getResources().getColor(
                                        R.color.green));
                        ((TextView) getActivity().findViewById(
                                R.id.fingerprintTakenInfoText))
                                .setText("Finger print taken.");
                    } catch (Exception exp) {
                        ((TextView) getActivity().findViewById(
                                R.id.fingerprintTakenInfoText))
                                .setText("Reading finger print data from file failed.");
                    }
                }
            } 

在调用我的应用程序secugen时,我有例外。错误是 enter image description here 我的SecuGen应用程序崩溃了。你能帮助我吗 ?

0 个答案:

没有答案