public void onActivityResult(int requestCode, int resultCode, Intent intent) {
//retrieve scan result
IntentResult scanningResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
//Intent Result object provides methods to retrieve the content of the scan
//and the format of the data returned from it.
if (scanningResult != null) { //vital to check for null values. Only proceed if we have a valid result.
//we have a result
String scanContent = scanningResult.getContents(); // Retrieve the content as a string value
String scanFormat = scanningResult.getFormatName(); //Retrieve the format name, also as a string.
//Now your program has the format and content of the scanned data,
//so you can do whatever you want with it.
formatTxt.setText("FORMAT: " + scanFormat);
contentTxt.setText("CONTENT: " + scanContent);
}
else{
Toast toast = Toast.makeText(getApplicationContext(),
"No scan data received!", Toast.LENGTH_SHORT);
toast.show();
}
}
how do i compare value stored in scanContent with info(eg:std_num) stored in my database? if the one of the value matched, it will toast/print the related info eg:name
btw I used sqlite browser to create my database and table.
Aucun commentaire:
Enregistrer un commentaire