No result from barcode scan

  • king0fpain

    king0fpain - 2012-03-15

    I'm trying to scan this image using native library. I'm always getting "0" from scanner.scanImage(barcode):

    [Java Code/url]


    Thanks to bring ZBar to Android.](

  • king0fpain

    king0fpain - 2012-03-15
  • Lisa Huang

    Lisa Huang - 2012-03-15

    I suspect there's an issue with the data formats not matching (ie: we can't just assume it's Y800).
    Try this out, it worked for me.

                        Bitmap barcodeBmp = BitmapFactory.decodeResource(getResources(),
                        int width = barcodeBmp.getWidth();
                        int height = barcodeBmp.getHeight();
                        int pixels = new int;

                        barcodeBmp.getPixels(pixels, 0, width, 0, 0, width, height);

                        Image barcode = new Image(width, height, "RGB4");

                        int result = scanner.scanImage(barcode.convert("Y800"));

    I'll add this test to the examples.

  • king0fpain

    king0fpain - 2012-03-15

    It works! Thank you!

  • Heba Othman Elzaree

    Hey i am new to scanning and i have the same problem but i couldn't fix it it gives me java.lang.ArrayIndexOutOfBoundsException
    can u help me Lisa Huang plz?

    Last edit: Heba Othman Elzaree 2013-05-21

Log in to post a comment.