Search code examples
androidzxing

Link to new activity from IntentIntegrator


Our project consists of making an app that handles group payments. You can join a group by scanning a QRCode containing the id of the group you want to join. We have made an activity "AddOrJoinActivity" in which you can either Create or Join a group (By scanning the QR-Code). I have made a new Activity containing my CustomScanner which works. The problem however is the following. I call the Customscanner from within the "AddOrJoinActivity" but once the code is scanned I want the program to open the activity "Groupdetails" containing all the details of the group he/she just joined.

I tried the following: In "AddOrJoinActivity"

IntentIntegrator ii = new IntentIntegrator(this)
ii.setCaptureActivity(CustomScanner.class).initiateScan();

In "CustomScanner"

barcodeView =(CompoundBarcodeView)findViewById(R.id.customViewBarcode);
capture = new CaptureManager(this,barcodeView);
capture.initializeFromIntent(getIntent(),savedInstanceState);
capture.decode();

I tried making a new intent in Customscanner containing the GroupsDetailActivity and using that in the capture.initializeFromIntent() but that didn't work.

How can i start the groupdetailsactivity from the CustomScanner ?

Thanks in advance


Solution

  • Have you seen this tutorial? http://code.tutsplus.com/tutorials/android-sdk-create-a-barcode-reader--mobile-17162

    In your case, after scanning, in your code of AddOrJoin, the method onActivityResult will automatically execute. In that method, you'll retrieve your scanning results and can you do you magic in the database.

    Start after the magic a new Activity:

    Intent intent = new Intent(this, NextActivity.class);
    startActivity(intent);
    

    That's my opinion.