QR Code - Android Application mode,

QR Code - Android Application mode,

Good morning. nice to meet you.  Please make a big hit all you do.

I would like to receive QR code at smartphone.

Are you know QR code examples and libraries for Android. If you know, please share it.

Answers

  • @Gwak===

    Zebra Crossing lib is done for that; as for qr code:

    import com.google.zxing.integration.android.IntentIntegrator; import com.google.zxing.integration.android.IntentResult;

    and create an intent for scanning.

  • import com.google.zxing.*;
    import java.io.ByteArrayInputStream;
    import javax.imageio.ImageIO;
    import com.google.zxing.common.*;
    import com.google.zxing.client.j2se.*;
    import android.graphics.Bitmap;
    import ketai.camera.*;
    
    KetaiCamera cam;
    boolean globalHistogram = false;
    com.google.zxing.Reader reader = new com.google.zxing.MultiFormatReader();
    void setup() {
      orientation(LANDSCAPE);
      imageMode(CENTER);
      cam = new KetaiCamera(this, 320, 240, 24);
    }
    
    void draw() {
      image(cam, width/2, height/2);
    }
    void populateYUVLuminanceFromRGB(int[] rgb, byte[] yuv420sp, int width, int height) {
      for (int i = 0; i < width * height; i++) {
        float red = (rgb[i] >> 16) & 0xff;
        float green = (rgb[i] >> 8) & 0xff;
        float blue = (rgb[i]) & 0xff;
        int luminance = (int) ((0.257f * red) + (0.504f * green) + (0.098f * blue) + 16);
        yuv420sp[i] = (byte) (0xff & luminance);
      }
    }
    void onCameraPreviewEvent()
    {
      cam.read();
      Bitmap camBitmap = (Bitmap) cam.getNative();
      int w = camBitmap.getWidth();
      int h = camBitmap.getHeight();
      int[] rgb = new int[w * h];
      byte[] yuv = new byte[w * h];
    
      camBitmap.getPixels(rgb, 0, w, 0, 0, w, h);
      populateYUVLuminanceFromRGB(rgb, yuv, w, h);
      PlanarYUVLuminanceSource source = new PlanarYUVLuminanceSource(yuv, w, h, 0, 0, w, h, false);
      BinaryBitmap bitmap;
      if (globalHistogram)
        bitmap = new BinaryBitmap(new GlobalHistogramBinarizer(source)); 
      else
    
        bitmap = new BinaryBitmap(new HybridBinarizer(source)); 
      Result result = null;
      try {
        result = reader.decode(bitmap);
      } 
      catch (Exception e) {
      }
      //Once we get the results, we can do some display
      if (result != null &&
        result.getText() != null) { 
        println(result.getText());
      }
      //LuminanceSource source = new PlanarYUVLuminanceSource(, 0, 0, cam.width, cam.height, false);
    }
    
    // start/stop camera preview by tapping the screen
    void mousePressed()
    {
      if (cam.isStarted())
      {
        cam.stop();
      } else
        cam.start();
    }
    void keyPressed() {
      if (key == CODED) {
        if (keyCode == MENU) {
          if (cam.isFlashEnabled())
            cam.disableFlash();
          else
            cam.enableFlash();
        }
      }
    }
    

    fig

    Hello, import javax.imageio.ImageIO;

    Is there any reason to go to error?

  • @Gwak===

    sorry, i cannot read the error message: too little!

Sign In or Register to comment.