亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Android實(shí)現(xiàn)基于ZXing快速集成二維碼掃描功能

 更新時(shí)間:2017年07月12日 10:15:11   作者:zhangphil  
這篇文章主要為大家詳細(xì)介紹了Android二維碼掃描ZXing快速項(xiàng)目集成的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

二維碼掃描現(xiàn)在是一直比較多的應(yīng)用場(chǎng)景,android的開源項(xiàng)目ZXing提供了完整、成熟的解決方案,如果僅僅是出于快速開發(fā)的目的,可以根據(jù)自己的項(xiàng)目需要,把ZXing官方提供的項(xiàng)目稍加裁剪,就可以快速的集成到自己的項(xiàng)目中。下面詳細(xì)演示和介紹如何實(shí)現(xiàn)基于ZXing官方提供的源碼,快速集成二維碼掃描功能到自己項(xiàng)目中的解決方案。 

(第1步):到ZXing官方主頁(yè)下載最新的項(xiàng)目代碼包,ZXing在github的官方主頁(yè):https://github.com/zxing,下載后解壓。解壓后根目錄下有若干項(xiàng)目目錄,其中的:android就是我們需要的項(xiàng)目,把它導(dǎo)入到Eclispse中。 

(第2步):ZXing的Android項(xiàng)目需要引用兩個(gè)關(guān)鍵的庫(kù)文件:android-core-x.x.x.jarcore-x.x.x.jar,其中x.x.x表示版本號(hào)。截止發(fā)表本博文時(shí)候,版本已經(jīng)是3.2.0了。這兩個(gè)關(guān)鍵的android-core-x.x.x.jar 和 core-x.x.x.jar 文件,實(shí)際上都可以從第一步下載得到的源代碼中自己編譯生成,網(wǎng)上也有編譯的具體方案,但簡(jiǎn)單期間,也可以從ZXing的官方直接下載已經(jīng)編譯好的文件,其中android-core的下載鏈接是:http://repo1.maven.org/maven2/com/google/zxing/android-core/,另外一個(gè)ZXing的core下載鏈接是:http://repo1.maven.org/maven2/com/google/zxing/core/ ,選擇最新版本的庫(kù)文件或者自己需要的版本號(hào),下載后,和其他android項(xiàng)目中導(dǎo)入庫(kù)文件類似,導(dǎo)入到Android項(xiàng)目中的libs目錄下,如果沒有l(wèi)ibs,新建一個(gè)名為libs的目錄,把兩個(gè)庫(kù)文件放進(jìn)去即可。 

(第3步):這一步作為演示,我們自己新建一個(gè)MainActiviy,作為項(xiàng)目的啟動(dòng)器Activity,App將啟動(dòng)我們自己的MainActivity。觀察ZXing官方提供的AndroidManifest.xml文件: 

<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (C) 2008 ZXing authors

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.google.zxing.client.android"
   android:versionName="4.7.3"
   android:versionCode="103"
   android:installLocation="auto">

 <uses-permission android:name="android.permission.CAMERA"/>
 <uses-permission android:name="android.permission.INTERNET"/>
 <uses-permission android:name="android.permission.VIBRATE"/>
 <uses-permission android:name="android.permission.FLASHLIGHT"/>
 <uses-permission android:name="android.permission.READ_CONTACTS"/>
 <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

 <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21"/>

 <!-- Don't require camera, as this requires a rear camera. This allows it to work on the Nexus 7 -->
 <uses-feature android:name="android.hardware.camera" android:required="false"/>
 <uses-feature android:name="android.hardware.camera.front" android:required="false"/>
 <!-- TODO replace above two with next line after Android 4.2 -->
 <!-- <uses-feature android:name="android.hardware.camera.any"/> -->
 <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
 <uses-feature android:name="android.hardware.camera.flash" android:required="false"/>
 <uses-feature android:name="android.hardware.screen.landscape"/>
 <uses-feature android:name="android.hardware.wifi" android:required="false"/>
 <!-- This excludes Google TV, which is unfortunately included by virtue of not requiring a camera -->
 <uses-feature android:name="android.hardware.touchscreen"/>
 <!-- TODO make this not required again after android.hardware.camera.any is available -->

 <supports-screens android:xlargeScreens="true"
     android:largeScreens="true"
     android:normalScreens="true"
     android:smallScreens="true"
     android:anyDensity="true"/>

 <application android:icon="@drawable/launcher_icon"
    android:logo="@drawable/launcher_icon"
    android:label="@string/app_name"
    android:allowBackup="true">
 <activity android:name=".CaptureActivity"
    android:screenOrientation="sensorLandscape"
    android:clearTaskOnLaunch="true"
    android:stateNotNeeded="true"
    android:theme="@style/CaptureTheme"
    android:windowSoftInputMode="stateAlwaysHidden">
  <intent-filter>
  <action android:name="android.intent.action.MAIN"/>
  <category android:name="android.intent.category.LAUNCHER"/>
  </intent-filter>
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SCAN"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
  <!-- Allow web apps to launch Barcode Scanner by linking to http://zxing.appspot.com/scan. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="zxing.appspot.com" android:path="/scan"/>
  </intent-filter>
  <!-- We also support a Google Product Search URL. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="www.google.com" android:path="/m/products/scan"/>
  </intent-filter>
  <!-- And the UK version. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="www.google.co.uk" android:path="/m/products/scan"/>
  </intent-filter>
  <!-- Support zxing://scan/?... like iPhone app -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="zxing" android:host="scan" android:path="/"/>
  </intent-filter>
 </activity>
 <activity android:name=".PreferencesActivity"
    android:label="@string/preferences_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".encode.EncodeActivity"
    android:stateNotNeeded="true">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.ENCODE"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
  <!-- This allows us to handle the Share button in Contacts. -->
  <intent-filter>
  <action android:name="android.intent.action.SEND"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/x-vcard"/>
  </intent-filter>
  <!-- This allows us to handle sharing any plain text . -->
  <intent-filter>
  <action android:name="android.intent.action.SEND"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/plain"/>
  </intent-filter>
 </activity>
 <activity android:name=".book.SearchBookContentsActivity"
    android:label="@string/sbc_name"
    android:stateNotNeeded="true"
    android:screenOrientation="sensorLandscape">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SEARCH_BOOK_CONTENTS"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
 </activity>
 <activity android:name=".share.ShareActivity"
    android:stateNotNeeded="true"
    android:screenOrientation="user">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SHARE"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
 </activity>
 <activity android:name=".history.HistoryActivity"
    android:label="@string/history_title"
    android:stateNotNeeded="true"/>
 <activity android:name=".share.BookmarkPickerActivity"
    android:label="@string/bookmark_picker_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".share.AppPickerActivity"
    android:label="@string/app_picker_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".HelpActivity"
    android:label="@string/menu_help"
    android:screenOrientation="user"
    android:stateNotNeeded="true"/>
 </application>

</manifest>

其實(shí)ZXing官方的項(xiàng)目已經(jīng)作為為第三方提供集成的代碼了,比如其中的關(guān)鍵Activity:.\src\com\google\zxing\client\android\CaptureActivity.Java,在聲明中已經(jīng)提供好了從各種入口訪問(wèn)的Intent的Action。所以在我們自己新建的MainActivity中,直接隱式指定一個(gè)Intent的Action,啟動(dòng)之即可: 

package com.google.zxing.client.android;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;

public class MainActivity extends Activity {

 private final int REQUEST_CODE = 0xa1;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);

 Intent intent = new Intent();
 //隱式指定
 intent.setAction("com.google.zxing.client.android.SCAN");
 
 //啟動(dòng)ZXing已經(jīng)寫好、且我們做小量修改后的CaptureActivity。
 startActivityForResult(intent, REQUEST_CODE);
 }

 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
 super.onActivityResult(requestCode, resultCode, data);

 //我們需要的結(jié)果返回
 if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) {

 //result就是二維碼掃描的結(jié)果。
 String result = data.getStringExtra("RESULT");

 Toast.makeText(getApplicationContext(), result, Toast.LENGTH_SHORT)
  .show();
 }
 }
}

因?yàn)槲覀儐?dòng)ZXing的CaptureActivity不是目的,真正的目的是啟動(dòng)ZXing的CaptureActivity獲得二維碼掃描結(jié)果,因此以startActivityForResult()的方式啟動(dòng)。相應(yīng)的,我們需要重寫:protected void onActivityResult(int requestCode, int resultCode, Intent data),以回調(diào)等待傳回結(jié)果。

(第4步):這一步是重點(diǎn)。在.\src\com\google\zxing\client\android\目錄下的CaptureActivity.java中的方法: public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor);此方法是一個(gè)回調(diào)函數(shù)。ZXing項(xiàng)目中寫好的掃描模塊掃描后返回回調(diào)此方法,ZXing官方的原始 public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor)方法是這樣的: 

/**
 * A valid barcode has been found, so give an indication of success and show the results.
 *
 * @param rawResult The contents of the barcode.
 * @param scaleFactor amount by which thumbnail was scaled
 * @param barcode A greyscale bitmap of the camera data which was decoded.
 */
 public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
 inactivityTimer.onActivity();
 lastResult = rawResult;
 ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);

 boolean fromLiveScan = barcode != null;
 if (fromLiveScan) {
  historyManager.addHistoryItem(rawResult, resultHandler);
  // Then not from history, so beep/vibrate and we have an image to draw on
  beepManager.playBeepSoundAndVibrate();
  drawResultPoints(barcode, scaleFactor, rawResult);
 }

 switch (source) {
  case NATIVE_APP_INTENT:
  case PRODUCT_SEARCH_LINK:
  handleDecodeExternally(rawResult, resultHandler, barcode);
  break;
  case ZXING_LINK:
  if (scanFromWebPageManager == null || !scanFromWebPageManager.isScanFromWebPage()) {
   handleDecodeInternally(rawResult, resultHandler, barcode);
  } else {
   handleDecodeExternally(rawResult, resultHandler, barcode);
  }
  break;
  case NONE:
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
   Toast.makeText(getApplicationContext(),
       getResources().getString(R.string.msg_bulk_mode_scanned) + " (" + rawResult.getText() + ')',
       Toast.LENGTH_SHORT).show();
   // Wait a moment or else it will scan the same barcode continuously about 3 times
   restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
  } else {
   handleDecodeInternally(rawResult, resultHandler, barcode);
  }
  break;
 }
 }

 我們將精簡(jiǎn)此方法,定制自己所需要的內(nèi)容,為滿足我們自己項(xiàng)目中的需求,把此方法修改后的代碼為:

 public void handleDecode(Result rawResult, Bitmap barcode, float scaleFactor) {
 inactivityTimer.onActivity();
 lastResult = rawResult;
 ResultHandler resultHandler = ResultHandlerFactory.makeResultHandler(this, rawResult);

 boolean fromLiveScan = barcode != null;
 if (fromLiveScan) {
  historyManager.addHistoryItem(rawResult, resultHandler);
  // Then not from history, so beep/vibrate and we have an image to draw on
  beepManager.playBeepSoundAndVibrate();
  drawResultPoints(barcode, scaleFactor, rawResult);
 }
 
 
 //在這里增加我們的代碼,目的是:做最小量的修改,僅僅把ZXing提供的CaptureActivity作為一個(gè)中間使用的Activity集成到我們自己的項(xiàng)目。
 //啟動(dòng)實(shí)現(xiàn)二維碼掃描,返回一個(gè)結(jié)果就可以了。
 //然后結(jié)束這個(gè)Activity。
 Intent intent=new Intent();
 //<key,value>形式存儲(chǔ)二維碼結(jié)果。
 //rawResult.getText()即為二維碼結(jié)果。
 intent.putExtra("RESULT", rawResult.getText());
 this.setResult(Activity.RESULT_OK, intent);
 this.finish();
 
 
 /**
 以下是ZXing提供的源碼,根據(jù)項(xiàng)目需要可以刪減使用。
 簡(jiǎn)單期間,我們只需要二維碼掃描后返回一個(gè)掃描的字符串結(jié)果。
 所以在次暫時(shí)注釋掉。
 
 switch (source) {
  case NATIVE_APP_INTENT:
  case PRODUCT_SEARCH_LINK:
  handleDecodeExternally(rawResult, resultHandler, barcode);
  break;
  case ZXING_LINK:
  if (scanFromWebPageManager == null || !scanFromWebPageManager.isScanFromWebPage()) {
   handleDecodeInternally(rawResult, resultHandler, barcode);
  } else {
   handleDecodeExternally(rawResult, resultHandler, barcode);
  }
  break;
  case NONE:
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
  if (fromLiveScan && prefs.getBoolean(PreferencesActivity.KEY_BULK_MODE, false)) {
   Toast.makeText(getApplicationContext(),
       getResources().getString(R.string.msg_bulk_mode_scanned) + " (" + rawResult.getText() + ')',
       Toast.LENGTH_SHORT).show();
   // Wait a moment or else it will scan the same barcode continuously about 3 times
   restartPreviewAfterDelay(BULK_MODE_SCAN_DELAY_MS);
  } else {
   handleDecodeInternally(rawResult, resultHandler, barcode);
  }
  break;
 }
 
 **/
 }

 (第5步):這一步比較簡(jiǎn)單,是剩余的收尾工作,修改AndroidManifest.xml文件,把我們的MainActivity作為主Activity啟動(dòng)。把ZXing的CaptureActivity作為一個(gè)普通的Activity。 

修改后的AndroidManifest.xml文件:

 <?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (C) 2008 ZXing authors

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   package="com.google.zxing.client.android"
   android:versionName="4.7.3"
   android:versionCode="103"
   android:installLocation="auto">

 <uses-permission android:name="android.permission.CAMERA"/>
 <uses-permission android:name="android.permission.INTERNET"/>
 <uses-permission android:name="android.permission.VIBRATE"/>
 <uses-permission android:name="android.permission.FLASHLIGHT"/>
 <uses-permission android:name="android.permission.READ_CONTACTS"/>
 <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>
 <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

 <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21"/>

 <!-- Don't require camera, as this requires a rear camera. This allows it to work on the Nexus 7 -->
 <uses-feature android:name="android.hardware.camera" android:required="false"/>
 <uses-feature android:name="android.hardware.camera.front" android:required="false"/>
 <!-- TODO replace above two with next line after Android 4.2 -->
 <!-- <uses-feature android:name="android.hardware.camera.any"/> -->
 <uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
 <uses-feature android:name="android.hardware.camera.flash" android:required="false"/>
 <uses-feature android:name="android.hardware.screen.landscape"/>
 <uses-feature android:name="android.hardware.wifi" android:required="false"/>
 <!-- This excludes Google TV, which is unfortunately included by virtue of not requiring a camera -->
 <uses-feature android:name="android.hardware.touchscreen"/>
 <!-- TODO make this not required again after android.hardware.camera.any is available -->

 <supports-screens android:xlargeScreens="true"
     android:largeScreens="true"
     android:normalScreens="true"
     android:smallScreens="true"
     android:anyDensity="true"/>

 <application android:icon="@drawable/launcher_icon"
    android:logo="@drawable/launcher_icon"
    android:label="@string/app_name"
    android:allowBackup="true">
  
  
 <!-- 新增的我們自己的MainActiviy作為啟動(dòng)Activity -->
 <activity
   android:name=".MainActivity"
   android:label="@string/app_name" >
   <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
   </intent-filter>
 </activity>
  
  
 <activity android:name=".CaptureActivity"
    android:screenOrientation="sensorLandscape"
    android:clearTaskOnLaunch="true"
    android:stateNotNeeded="true"
    android:theme="@style/CaptureTheme"
    android:windowSoftInputMode="stateAlwaysHidden">
  
  <!-- 
  把ZXing官方提供的作為 main activity啟動(dòng)的CaptureActivity作為一個(gè)普通Activiy。
  
  <intent-filter>
  <action android:name="android.intent.action.MAIN"/>
  <category android:name="android.intent.category.LAUNCHER"/>
  </intent-filter>
  
  --> 
  
  
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SCAN"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
  <!-- Allow web apps to launch Barcode Scanner by linking to http://zxing.appspot.com/scan. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="zxing.appspot.com" android:path="/scan"/>
  </intent-filter>
  <!-- We also support a Google Product Search URL. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="www.google.com" android:path="/m/products/scan"/>
  </intent-filter>
  <!-- And the UK version. -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="http" android:host="www.google.co.uk" android:path="/m/products/scan"/>
  </intent-filter>
  <!-- Support zxing://scan/?... like iPhone app -->
  <intent-filter>
  <action android:name="android.intent.action.VIEW"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <category android:name="android.intent.category.BROWSABLE"/>
  <data android:scheme="zxing" android:host="scan" android:path="/"/>
  </intent-filter>
 </activity>
 <activity android:name=".PreferencesActivity"
    android:label="@string/preferences_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".encode.EncodeActivity"
    android:stateNotNeeded="true">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.ENCODE"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
  <!-- This allows us to handle the Share button in Contacts. -->
  <intent-filter>
  <action android:name="android.intent.action.SEND"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/x-vcard"/>
  </intent-filter>
  <!-- This allows us to handle sharing any plain text . -->
  <intent-filter>
  <action android:name="android.intent.action.SEND"/>
  <category android:name="android.intent.category.DEFAULT"/>
  <data android:mimeType="text/plain"/>
  </intent-filter>
 </activity>
 <activity android:name=".book.SearchBookContentsActivity"
    android:label="@string/sbc_name"
    android:stateNotNeeded="true"
    android:screenOrientation="sensorLandscape">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SEARCH_BOOK_CONTENTS"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
 </activity>
 <activity android:name=".share.ShareActivity"
    android:stateNotNeeded="true"
    android:screenOrientation="user">
  <intent-filter>
  <action android:name="com.google.zxing.client.android.SHARE"/>
  <category android:name="android.intent.category.DEFAULT"/>
  </intent-filter>
 </activity>
 <activity android:name=".history.HistoryActivity"
    android:label="@string/history_title"
    android:stateNotNeeded="true"/>
 <activity android:name=".share.BookmarkPickerActivity"
    android:label="@string/bookmark_picker_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".share.AppPickerActivity"
    android:label="@string/app_picker_name"
    android:stateNotNeeded="true"/>
 <activity android:name=".HelpActivity"
    android:label="@string/menu_help"
    android:screenOrientation="user"
    android:stateNotNeeded="true"/>
 </application>

</manifest>

備注:此文僅僅是最簡(jiǎn)單的一個(gè)示例,演示了如何在自己的項(xiàng)目中在ZXing官方項(xiàng)目已提供的完整代碼基礎(chǔ)上,做最小量的改動(dòng),將二維碼掃描功能快速集成到自己的項(xiàng)目中為我所用,若需要更多的細(xì)節(jié)調(diào)整,則需要深入定制和改編源代碼。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論