当我运行模拟器时,我在我的代码代码中使用条形码库工作正常,此错误将出现原因:android.content.ActivityNotFoundException:未找到处理 Intent { act=com.google.zxing.client.android.SCAN }
package my.finalyear.demo;
public class CaptureActivity extends Activity {
final Context context = this;
String contents;
String searchFor;
static final String KEY_ITEM = "item"; // parent node
static final String KEY_ID = "id";
static final String KEY_NAME = "name";
static final String KEY_COST = "cost";
static final String KEY_DESC = "description";
public static String name, cost, description;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
startActivityForResult(intent, 0);
}
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
// String result =intent.getAction();
contents = intent.getStringExtra("SCAN_RESULT");
String format =
intent.getStringExtra("SCAN_RESULT_FORMAT");
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="my.finalyear.demo"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
/>
<application
android:icon="@drawable/launcher_icon"
android:label="@string/app_name"
>
<activity
android:name=".LoginActivity" android:configChanges="orientation|keyboardHidden"
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.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:label="MainScreen"
android:name=".CaptureActivity" >
</activity>
<activity
android:label="Single Menu Item"
android:name="my.finalyear.demo.SingleMenuItemActivity" >
</activity>
</application>
<uses-permission android:name="android.permission.CAMERA"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"></uses-permission>
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<uses-feature android:name="android.hardware.camera.flash" />