library 用zxing2.1版本
1匯入project "android"
2把core裡面的core.jar放到上1步驟專案的 新建一個libs資料夾下 就沒有錯誤了
3.右鍵點專案選porperty -> android ->islibrary鉤起來
4.到自已專案 porperty-> android ->add library
5.記得把activity加入自己專案
6.Intent intent = new Intent(getActivity(),
CaptureActivity.class);
// Intent intent = new
// Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);
//接收訊息
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
Log.d("tf", "resultCode = " + resultCode);
if (requestCode == 0) {
if (resultCode == 1) {
// Handle successful scan
String capturedQrValue = intent.getStringExtra("RESULT");
//String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
// Toast.makeText(FragQRCodeScan.this,"Scan Result:" + capturedQrValue, Toast.LENGTH_SHORT).show();
} else if (resultCode == 2) {
// Handle cancel
}
} else {
}
}
7.會呈90度翻轉 http://rritw.com/a/bianchengyuyan/C__/20130425/346558.html