日期:2014-05-17 浏览次数:20979 次
    /**
     * Called when the barcode scanner exits
     *
     * @param requestCode        The request code originally supplied to startActivityForResult(),
     *                             allowing you to identify who this result came from.
     * @param resultCode        The integer result code returned by the child activity through its setResult().
     * @param intent            An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
     */
    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
        if (requestCode == REQUEST_CODE) {
            if (resultCode == Activity.RESULT_OK) {
                String contents = intent.getStringExtra("SCAN_RESULT");
                String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
                this.success(new PluginResult(PluginResult.Status.OK, "内容:"+contents+"编码方式?:"+format), this.callback);
            } else {
                this.error(new PluginResult(PluginResult.Status.ERROR), this.callback);
            }
        }
    }