我正在開發Cordova的應用程序,但Zxing的條形碼掃描儀在掃描產品後需要添加掃描/退出按鈕和關閉按鈕時自動打開和關閉掃描儀不應自動打開和關閉。我還需要檢查掃描的產品是否存在於數據庫中(SQL SERVER),並返回產品信息,我試圖谷歌,但無濟於事,請help.the以下是我在Eclipse中的代碼。我需要知道我可以如何修改UI並添加自己的控件來控制我在Eclipse中開發的ZXING條形碼掃描器插件,並在IIS中託管一個Web API服務,我可以訪問我的Android App.Please儘快或告訴我如何我可以修改此條形碼用戶界面以添加我的控件。PhoneGap條碼掃描儀問題
public void scan() {
Intent intentScan = new Intent(SCAN_INTENT);
intentScan.addCategory(Intent.CATEGORY_DEFAULT);
this.cordova.startActivityForResult((CordovaPlugin) this, intentScan, REQUEST_CODE);
}
我的OnStartActivity代碼是這裏的代碼,但它看起來像你的一樣。
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == REQUEST_CODE) {
if (resultCode == Activity.RESULT_OK) {
JSONObject obj = new JSONObject();
try {
obj.put(TEXT, intent.getStringExtra("SCAN_RESULT"));
obj.put(FORMAT, intent.getStringExtra("SCAN_RESULT_FORMAT"));
obj.put(CANCELLED, false);
} catch (JSONException e) {
Log.d(LOG_TAG, "This should never happen");
}
//this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
this.callbackContext.success(obj);
} else if (resultCode == Activity.RESULT_CANCELED) {
JSONObject obj = new JSONObject();
try {
obj.put(TEXT, "");
obj.put(FORMAT, "");
obj.put(CANCELLED, true);
} catch (JSONException e) {
Log.d(LOG_TAG, "This should never happen");
}
//this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
this.callbackContext.success(obj);
} else {
//this.error(new PluginResult(PluginResult.Status.ERROR), this.callback);
this.callbackContext.error("Unexpected error");
}
}
}
我已編輯和張貼我的代碼已經存在,但它仍然不能正常工作 –
對不起,延遲的答覆...所以它仍然在做同樣的事情..它打開掃描儀並關閉inmediatly ...嘗試使用另一個QR掃描儀...我建議你使用QR Droid – geekCode
艾特謝謝你的QR Droid工作比ZXIng更好嗎? –