Reputation: 1289
In my app,I want to create a image of QRCode shows on my Android screen (Without internet access). currently I know how to code the barcode scanner in my app, here the code for my scanner
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
however I also need to generate the QRCode image, I have research a bit, and got this(totally no idea how to code, I am just a learner><)
com.google.zxing.qrcode.encoder
Can someone show me how to generate a image of QRCode for Android, thanks a lot
Upvotes: 4
Views: 4010
Reputation: 46856
Here is a method that will encode for you.
private void encodeBarcode(String type, String data) {
Intent intent = new Intent("com.google.zxing.client.android.ENCODE");
intent.putExtra("ENCODE_TYPE", type);
intent.putExtra("ENCODE_DATA", data);
startActivity(intent);
}
here is an example usage
encodeBarcode("TEXT_TYPE", "http://androidninja.me");
The ZXingTestActivity.java contains some more examples, including all of the options for type.
Upvotes: 4