I implemented the scandit library in my google glass project, but if I'm scanning EAN-13 barcodes the last digit is always wrong. For example: I'm scanning a code with the value 2220141633626 and the result is 2220141633624.
This is my code in Activity 1:
public void didScanBarcode(String content, String format) {
// send the result to another activity.
Intent resultIntent = new Intent(this, TestingActivity.class);
resultIntent.putExtra("scanContent", content);
Log.v("scanbarcode", content);
startActivity(resultIntent);
}
This is my code in Activity 2:
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.testing);
Intent resultIntent = getIntent();
String scanContent = resultIntent.getExtras().getString("scanContent");
serialNumber = Long.parseLong(scanContent);
Log.e("string ", "" + scanContent);
Log.e("long ", "" + serialNumber);
}
The content is already wrong in the didScanBarcode method of my first activity.