androidmads/XAZxing

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference

Closed this issue · 0 comments

I'm calling the function initiateScan from a alertDialog

    LayoutInflater li = LayoutInflater.from(context);
    View promptsView = li.inflate(R.layout.konfirmasi_cash_prompt, null);

    final android.app.AlertDialog.Builder alertDialogBuilder = new android.app.AlertDialog.Builder(context);
    alertDialogBuilder
            .setView(promptsView)
            .setCancelable(false);

    android.app.AlertDialog alertDialog = alertDialogBuilder.create();

    scan.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            IntentIntegrator intentIntegrator = new IntentIntegrator(activity);
            intentIntegrator.forSupportFragment(ShiftCashBBMPartsFragment.this)
                    .setDesiredBarcodeFormats(intentIntegrator.QR_CODE_TYPES)
                    .setBeepEnabled(false)
                    .setPrompt("Scan Qr Code")
                    .initiateScan();
        }
    });

   alertDialog.show();