About 二维码扫描
简单的二维码扫描工具
开放,允许其它程序调用。以下是调用须知。
开发者文档:
// 参数及结果
mark.qrcode.SCAN // action
mark.qrcode //package
mark.qrcode.CaptureActivity //class
getStringExtra("data") //result
实例:
// 启动扫码
Intent intent = new Intent("mark.qrcode.SCAN");
intent.setClassName("mark.qrcode", "mark.qrcode.CaptureActivity");
try { activity.startActivityForResult(intent, 0); } catch (Exception ignored) { }
// 获取扫码结果
@Override
protected void onActivityResult(int requestCode, int resultCode,
Intent intent) {
if (requestCode == 0) {
if (intent != null && intent.hasExtra("data")) {
String result = intent.getStringExtra("data"); // 扫码结果
}
return;
}
} Simple two-dimensional code scanning tool
Open to allow other programs to call. The following is the call notes.
Developer Documentation:
// Parameters and results
mark.qrcode.SCAN // action
mark.qrcode // package
mark.qrcode.CaptureActivity // class
getStringExtra ( "data") // result
Example:
// Start the scan code
Intent intent = new Intent ( "mark.qrcode.SCAN");
intent.setClassName ( "mark.qrcode", "mark.qrcode.CaptureActivity");
try {activity.startActivityForResult (intent, 0);} catch (Exception ignored) {}
// Get the scan code results
@Override
protected void onActivityResult (int requestCode, int resultCode,
Intent intent) {
if (requestCode == 0) {
if (intent! = null && intent.hasExtra ( "data")) {
String result = intent.getStringExtra ( "data"); // scan code results
}
return;
}
}
by K####:
Nexus 5X摄像头是反着的!