
awalkingcity.com recently blogged about creating QR codes on the new T Mobile G1 android platform. The android code uses Googles API to generate the actual QR code. To get started developing your own QR code applications on androd devices just download the android sdk - software development kit from Google. Get you QR Code reader for android here http://www.qrme.co.uk/qr-code-resources/qr-code-readers.html
Original blog post http://awalkingcity.com/blog/?cat=5 .
To see the sample code click read more. There is also an excellent article at http://awalkingcity.com/blog/?p=116 and a complete android api reference guide at code.google.com.
See our android videos here http://www.qrme.co.uk/android-videos.html
Generate a QR code
encodeButton.setOnClickListener(new OnClickListener(){
public void onClick(View arg0) {
img.setImageBitmap(QR.this.encodeString(edit.getText().toString()));
}
});
private Bitmap encodeString(String input) {
URL aURL;
try {
aURL = new URL("http://chart.apis.google.com/chart?chs=300x300&cht=qr&choe=UTF- 8chl="+URLEncoder.encode(input, "UTF-8"));
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
Bitmap bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
return bm;
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
Decode a QR Code
decodeButton.setOnClickListener(new OnClickListener(){
public void onClick(View arg0) {
try {
tv.setText(((QR.this.decode(img.getDrawingCache()))));
} catch (ReaderException e) {
e.printStackTrace();
}
}
});
private String decode(Bitmap bm) throws ReaderException {
QRCodeReader reader = new QRCodeReader();
Result r = reader.decode( new RGBMonochromeBitmapSource(bm));
return r.getText();
}
| < Prev | Next > |
|---|


























