首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ZXing和Android

ZXing和Android
EN

Stack Overflow用户
提问于 2015-05-25 14:08:35
回答 1查看 631关注 0票数 1

我曾经在Eclipse中使用ZXing (QR扫描器),我知道它是如何工作的。现在,我在Android Studio尝试着做同样的事情。我添加了依赖项:

代码语言:javascript
复制
dependencies {
    compile 'com.android.support:support-v4:22.0.0'
    compile 'com.google.zxing:core:3.2.0'
    compile 'com.google.zxing:android-integration:3.2.0'
}

我清单中的CaptureActivity有问题,因为它没有被识别(“无法解决符号.”)。

这在我的AndroidManifest文件中:

代码语言:javascript
复制
<activity
        android:name="com.google.zxing.client.android.CaptureActivity"
        android:configChanges="orientation|keyboardHidden"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:windowSoftInputMode="stateAlwaysHidden" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
        <intent-filter>
            <action android:name="com.google.zxing.client.android.SCAN" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

我在启动QR代码扫描器时:

代码语言:javascript
复制
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
startActivityForResult(intent, 0);

并采用onActivityResult方法接受结果。

我知道核心库中没有CaptureActivity,但是在哪里可以找到它呢?我还需要在我的项目中添加其他东西(比如依赖关系或类似的东西)吗?

我不太熟悉Android,我最近开始使用它。

EN

回答 1

Stack Overflow用户

发布于 2016-04-27 09:17:59

也许您可以将代码更改为:

参考文献:Zxing scanner Android Studio

代码语言:javascript
复制
IntentIntegrator integrator = new IntentIntegrator(MainActivity.this);
integrator.initiateScan();
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/30440270

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档