I have to scan a barcode after a button press in an app mobile developed with Codenameone.
I've added the library cn1-codescan.cn1lib from https://github.com/codenameone/cn1-codescan and this is the code:
CodeScanner.getInstance().scanBarCode(new ScanResult()
{
public void scanCompleted(String contents, String formatName, byte[] rawBytes)
{
System.out.println(contents);
/*TextContent*/ tc.text(contents);
tc.revalidate();
System.out.println("scannato");
}
public void scanCanceled()
{
System.out.println("cancelled");
}
public void scanError(int errorCode, String message)
{
System.out.println("err " + message);
}
});
At the button press, in the simulation nothing appens (and it's fine), in the Android app it opens a second app to scan the barcode.
The problem is that this second app doesn't actually scan the code. It remains in "camera mode" but don't switch back to my app.
How can I switch back to my app with the barcode read?
(If I use this second app searately, opened by itself, it normally works and read the barcode)