Skip to content Skip to sidebar Skip to footer

Zxing Intent Request Code (identifying My Intent)

In my Android APP, whenever I need to call many different ActivitiesForResult from the same Activity, I do it like this: public void firstMethod() { int requestCode = 1; In

Solution 1:

I see 2 solutions. One would be creating a new activity, just to call the IntentIntegrator and putting the requestCode to this new activity.

Second option was to modify the IntentIntegrator - which is what I did.

I removed the final attribute,

// public static final int REQUEST_CODE = 0x0000c0de;publicstaticint REQUEST_CODE = 0x0000c0de;

added the function to set the request code:

publicvoidsetRequestCode(int requestCode){
    REQUEST_CODE = requestCode;
  }

and am calling the Barcode Scanner like this:

int requestCode = 2;
    IntentIntegrator intentintegrator= newIntentIntegrator (this);
    intentintegrator.setRequestCode(requestCode);
    intentintegrator.initiateScan(ZxingIntent.QR_CODE_TYPES);

I do not know what the RequestCode 0x0000c0de is for and why it is final, but the app seems to work.

Post a Comment for "Zxing Intent Request Code (identifying My Intent)"