GithubHelp home page GithubHelp logo

oudommeas / android-quick-response-code Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 1.78 MB

Automatically exported from code.google.com/p/android-quick-response-code

License: Apache License 2.0

Java 100.00%

android-quick-response-code's Introduction

android-quick-response-code

Android QR Code Decoder and Encoder

Introduction

This is a port of the ZXing (version 2.1) project but reduced in size and scope. It can be used as a direct call from any Android project instead of using the ZXing Intents mechanism.

This project is an attempt to make working with QR codes in Android a bit easier.

Encoding

You can encode a String fairly easily using the following code:

Encode with a QR Code

//Encode with a QR Code image
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder("Hello", 
                                                null, 
                                                Contents.Type.TEXT,  
                                                BarcodeFormat.QR_CODE.toString(), 
                                                smallerDimension);
Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();

Encode with a Barcode

//Encode with a QR Code image
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder("12345678910", 
                                                null, 
                                                Contents.Type.TEXT, 
                                                BarcodeFormat.UPC_A.toString(), 
                                                smallerDimension);
Bitmap bitmap = qrCodeEncoder.encodeAsBitmap();

Encoding Activity Example

You can see an example of how to ecode a string as a Bitmap and display it on the screen by following along with the EncoderActivity.java file.

Decoding

You can decode what is being displayed by the camera by extending Activity and implementing both IDecoderActivity and SurfaceHolder.Callback. An easier option is just to extend the DecoderActivity and override the handleDecode() method, the CaptureActivity does exactly that and is a good example to follow.

//When you initialize the camera, start the DecoderActivityHandler
//decodeFormarts is a Collection of BarcodeFormat objects to decipher. NULL means all.
//characterSet should be NULL to get a callbak
//cameraManager is used to control the preview
@Override
public void surfaceCreated(SurfaceHolder holder) {
    DecoderActivityHandler handler = new DecoderActivityHandler(this, 
                                                                decodeFormats, 
                                                                characterSet, 
                                                                cameraManager);
}

//handleDecode() is called when a code has been deciphered.
@Override 
public void handleDecode(Result rawResult, Bitmap barcode) {
    drawResultPoints(barcode, rawResult);
    ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);
    handleDecodeInternally(rawResult, resultHandler, barcode);
}

Decoding and Catpure Activity Example

You can see an example of how to decode an image by following along with the DecoderActivity.java file. You will also find a minimal example of how to decode an image and display it's results by following the CaptureActivity.java file.

Decoding Formats

  • Aztec 2D barcode format.
  • CODABAR 1D format.
  • Code 39 1D format.
  • Code 93 1D format.
  • Code 128 1D format.
  • Data Matrix 2D barcode format.
  • EAN-8 1D format.
  • EAN-13 1D format.
  • ITF (Interleaved Two of Five) 1D format.
  • MaxiCode 2D barcode format.
  • PDF417 format.
  • QR Code 2D barcode format.
  • RSS 14 format.
  • RSS EXPANDED format.
  • UPC-A 1D format.
  • UPC-E 1D format.
  • UPC/EAN extension format. Not a stand-alone format.

Encoding Formats

  • CODABAR 1D format.
  • Code 128 1D format.
  • Code 39 1D format.
  • EAN-8 1D format.
  • EAN-13 1D format.
  • ITF (Interleaved Two of Five) 1D format.
  • PDF417 format.
  • QR Code 2D barcode format.
  • UPC-A 1D format.

android-quick-response-code's People

Contributors

phishman3579 avatar

Stargazers

 avatar

Watchers

 avatar

android-quick-response-code's Issues

I have get JSON response of string and that is display into spinner

This is my response 
08-27 09:13:25.927: E/JSON(4376): 
{"subscriber_name":["MaheshKhatmode","Pranav","RameshSippy"]}


String res = getIntent().getStringExtra("Response");
        Log.d("Wallet_Management Response", "getIntent"  +res);
        //Subscriber_Name.setText(res);
        System.out.println("subscriber name response : " + res.toString());



         String[] strings = res.split("\\[ ");

         ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_item, strings);
                    dataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
                    dataAdapter.notifyDataSetChanged();
                    spinnerEmp.setAdapter(dataAdapter);

Original issue reported on code.google.com by [email protected] on 27 Aug 2014 at 1:19

Can i have scanner inside a fragment??

I am trying to use the Scanner inside a fragment. Since we need to extend an 
Activity, I am using LocalActivityManager to embed CaptureActivity inside a 
fragment. But Qr code Scanner stopped working. Any suggestion on this. Please 
help!

Original issue reported on code.google.com by [email protected] on 16 Apr 2013 at 3:13

Doesn't work on Samsung Tablet

Hi, 
I'm using this library for my Android app and it works perfectly on 
smartphones.... but it crashes on Samsung Tablet... is there any workaround to 
make it working also on that device? 
I tested the library also on Galaxy S i9000 and HTC hero and it works 
perfectly.... but on tablet it doesn't work at all...

please let me know.. thanks.





Original issue reported on code.google.com by [email protected] on 13 Dec 2011 at 7:53

iso 24778 encoding , fostering breadth features both

qr is only popular use because developers assume it is popular

true by construction hardly seems rigorous


have you considered the much wider used ISO 24778, Aztec code?

automotive, aerospace, transportation, military. similar to qr there is no 
license fee. Aztec is more resistant to damage or distortion even given both it 
and qr employ reed Solomon

zxing development team are largely responsible in the Android community for 
fostering the qr weak truism: refusing to implement Aztec ENCODING

qr block arrangent can suffer only proximal damage: low integrity


Original issue reported on code.google.com by [email protected] on 10 Dec 2012 at 2:22

URL SVN

Guys are u right that this link is correct?

http://android-quick-response-code.googlecode.com/svn/trunk/ 
android-quick-response-code-read-only

I cant read this with my svn client. This url doenst exists.

Im using Tortoise.

Original issue reported on code.google.com by [email protected] on 22 May 2012 at 1:13

android:theme="@android:style/Theme.Dialog" in CaptureActivity problem in view

What steps will reproduce the problem?
1. Use android:theme="@android:style/Theme.Dialog" in the capture activity

ex - <activity android:name="CaptureActivity"
            android:theme="@android:style/Theme.Dialog">

What is the expected output? What do you see instead?
Inner scanning area display at bottom right


What version of the product are you using? On what operating system?
Android 2.2


Please provide any additional information below.

following ondraw in Viewfinderview works for me. Please provide overiding 
ViewfinderView class 

 public void onDraw(Canvas canvas) {
        Rect frame = cameraManager.getFramingRect();
        if (frame == null) {
            return;
        }
        int width = canvas.getWidth();
        int height = canvas.getHeight();

        int frameDLeft = (width ) /4;
        int frameDRight = (width ) /4 * 3;

        int frameDTop = height/4;
        int frameDBottom = (height ) /4 * 3;

        // Draw the exterior (i.e. outside the framing rect) darkened
        paint.setColor(resultBitmap != null ? resultColor : maskColor);
        canvas.drawRect(0, 0, width, frameDTop, paint);
        canvas.drawRect(0, frameDTop, frameDLeft, frameDBottom + 1, paint);
        canvas.drawRect(frameDRight + 1, frameDTop, width, frameDBottom + 1, paint);
        canvas.drawRect(0, frameDBottom + 1, width, height, paint);



        if (resultBitmap != null) {
            // Draw the opaque result bitmap over the scanning rectangle
            paint.setAlpha(CURRENT_POINT_OPACITY);
            canvas.drawBitmap(resultBitmap, null, frame, paint);
        } else {

            // Draw a two pixel solid black border inside the framing rect
            paint.setColor(frameColor);
            canvas.drawRect(frameDLeft, frameDTop, frameDRight + 1, frameDTop + 2, paint);
            canvas.drawRect(frameDLeft, frameDTop + 2, frameDLeft + 2, frameDBottom - 1, paint);
            canvas.drawRect(frameDRight - 1, frameDTop, frameDRight + 1, frameDBottom - 1, paint);
            canvas.drawRect(frameDLeft, frameDBottom - 1, frameDRight + 1, frameDBottom + 1, paint);
....

Original issue reported on code.google.com by [email protected] on 29 Apr 2013 at 10:13

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.