I am creating an app to scan a set number of barcodes. I create an Intent for ZXing and call startActivityForResult.
Once the barcode is processed in onActivityResult, I call startActivityForResult using the Intent passed into onActivityResult.
This, unless I am mistaken, is a recursive call to onActivityResult. There could be up to 30 barcodes.
Is this okay? I would rather make direct API calls to ZXing, but I am having troubles finding examples.
This is not a recursive call to onActivityResult()
and should work just fine. It's not recursive because your onActivityResult()
calls startActivityForResult()
which returns right away and thus allows the onActivityResult()
method to finish it's execution. If it didn't, then there would be no need for the onActivityResult()
in the first place. You could just use the return value of startActivityForResult()
.