获取了吧code。在活动发起了扫描ZXing值 [英] Get the barcode value in the Activity which launched the scan ZXing

查看:199
本文介绍了获取了吧code。在活动发起了扫描ZXing值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将 Zxing 我的应用程序,它工作正常...(不使用意图)

I have integrated Zxing in my app and it works fine... (without using intents)

现在我想从启动扫描的活动1 ,然后扫描吧code 活性2 ,最后得到的吧code在扫描值活动1 其推出的扫描,但是当我审视它进入 Activity3 ,也有一些截图要想清楚。

Now I want to launch the scan from Activity1, and scan the barcode Activity2, and finally get the barcode scanned value in the Activity1 which launched the scan, but when I scan it goes to the Activity3, there are some screenshots to make it clear.

活动1:

Activity 1 :

活动2:

Activity 2 :

活动3:

Activity 3 :

我想只有Actiivity1和活性2和得到的结果在活动1。

I want to only have Actiivity1 and Activity2 and get the result in the Activity1.

下面是我的code:

public void onClick(View view) {
    Intent intent = new Intent(getApplicationContext(), CaptureActivity.class);
    intent.putExtra("SCAN_MODE", "");
    startActivityForResult(intent, 0);
}

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {
        TextView tvStatus = (TextView) findViewById(R.id.tvStatus);
        TextView tvResult = (TextView) findViewById(R.id.tvResult);
        if (resultCode == RESULT_OK) {
            tvStatus.setText(intent.getStringExtra("SCAN_RESULT_FORMAT"));
            tvResult.setText(intent.getStringExtra("SCAN_RESULT"));
        } else if (resultCode == RESULT_CANCELED) {
            tvStatus.setText("Press a button to start a scan.");
            tvResult.setText("Scan cancelled.");
        }
    }
}

功能的onclick 被称为当我点击相关活动,的按钮。

the function onclick is called when I click on the button of the activity1.

请你对此有任何想法?

感谢您:)

推荐答案

他们有自己的维基一个很好的网页有关如何在ZXing库集成到您的应用程序。 这里是一个链接到文章

They have a really good page on their Wiki about how to integrate the ZXing library into your app. Here is a link to the article.

这篇关于获取了吧code。在活动发起了扫描ZXing值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆