Code example for TextureView

Methods: getBitmap

    public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
        //This is where you get the image to check for barcode 
        // read the image from the SurfaceTexture 
        Bitmap barcodeBmp = mTextureView.getBitmap();
        //get pixel array 
        int width = barcodeBmp.getWidth();
        int height = barcodeBmp.getHeight();
        int[] pixels = new int[barcodeBmp.getHeight() * barcodeBmp.getWidth()];
        barcodeBmp.getPixels(pixels, 0, width, 0, 0, width, height);
        If using zbar barcode processing library. 
        // create a barcode image 
		Image barcode = new Image(width, height, "RGB4"); 
		int result = mScanner.scanImage(barcode.convert("Y800"));