Issue 740 user-suggested patch to return bytes

git-svn-id: https://zxing.googlecode.com/svn/trunk@1724 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2011-03-09 20:41:52 +00:00
parent 9e8fb1e2ff
commit 27445b32cd
2 changed files with 10 additions and 0 deletions

View file

@ -532,6 +532,10 @@ public final class CaptureActivity extends Activity implements SurfaceHolder.Cal
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.putExtra(Intents.Scan.RESULT, rawResult.toString());
intent.putExtra(Intents.Scan.RESULT_FORMAT, rawResult.getBarcodeFormat().toString());
byte[] rawBytes = rawResult.getRawBytes();
if (rawBytes != null && rawBytes.length > 0) {
intent.putExtra(Intents.Scan.RESULT_BYTES, rawBytes);
}
Message message = Message.obtain(handler, R.id.return_scan_result);
message.obj = intent;
handler.sendMessageDelayed(message, INTENT_RESULT_DURATION);

View file

@ -93,6 +93,12 @@ public final class Intents {
*/
public static final String RESULT_FORMAT = "SCAN_RESULT_FORMAT";
/**
* Call intent.getByteArrayExtra(RESULT_BYTES) to get a {@link byte[]} of raw bytes in the
* barcode, if available.
*/
public static final String RESULT_BYTES = "SCAN_RESULT_BYTES";
/**
* Setting this to false will not save scanned codes in the history.
*/