I'm trying to read QR_Code unlimited times with Bar-code Scanner. I'm doing like this:
for(int i = 1; i <= 10; i++){
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 10);
}
With this code I open bar-code 10 times, but I want to open it unlimited times until the user press the back button on Android! If I put a higher number in the place of '10' my app crashes because I'll open and open and open and open the bar-code a lot of times.
I'm not sure I'm explaining it correctly, please let me know if I need to explain it better.
I understand what you mean, but this is not guaranteed to work, and even when it "works" as you intend, it is a terrible user experience. Activities can respond to the same intent in one instance, and may be written to forget any other Intents "in progress". Even if you spawn 10 activities, it's really not nice to make the user pop back through a stack 10 deep.
You really want to invoke the scanner, wait for the result, then invoke another scan, which is what FoamyGuy is pointing you to.