Created
May 31, 2018 14:45
-
-
Save dario61081/dadc5e705c44bb13a7dae9130226e032 to your computer and use it in GitHub Desktop.
Correcion lectura modeless del codigo de barra seuic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Parsing barcode | |
| * | |
| * @param barcode codigo de barra en crudo | |
| * @return codigo de barra pulido | |
| */ | |
| String parseBarcode(String barcode) { | |
| Log.w(TAG, "parseBarcode: " + barcode ); | |
| int index1 = barcode.indexOf(0x02); | |
| int index2 = barcode.indexOf(0x13); | |
| if (index2 != -1){ | |
| //modo 1D | |
| Log.w(TAG, "parseBarcode: 1D" ); | |
| return barcode.substring(index1 + 1 , index2); | |
| }else{ | |
| //modo 2D | |
| Log.w(TAG, "parseBarcode: 2D" ); | |
| index2 = (int) barcode.getBytes()[1]; | |
| return barcode.substring(index1 + 1 ,index1 + (index2 - index1) ); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment