I am a new in developing area. I am trying to deal with the results after scanning a QR image. I am using the Zxing library. Right now only the content string can retrieve any data. But I want to scan a qr image to get the URL, telno and a string /text(which will be a numbered amount).
Could you pls show that with an example how can i get the data for telno and text both and store in strings. For now there is only one SCAN_RESULT which is stored in contents, but how can I get multiple results at a time from one QR code.
private void onQrActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
Log.d(TAG, "onActivityResult " + resultCode);
String contents = data.getStringExtra("SCAN_RESULT");
String format = data.getStringExtra("SCAN_RESULT_FORMAT");
paymentmsg.setText(contents);
value_Qr = Float.parseFloat(contents);
// Toast.makeText(this, format, Toast.LENGTH_SHORT).show();
format = data.getStringExtra("SCAN_RESULT_FORMAT");
// Handle successful scan
}
else if (resultCode == RESULT_CANCELED) {
// Handle cancel
}
}
}
You have to parse the result. The result is in the content string. parse the content string.
If your qr code is contact
if your qr scannrd is url
if your qr scanned is location qr
And so on you can parse the result. Its all about how you can parse a string.