I downloaded zxing project and I created a simple activity with a button. This simple activity should start zxing project when the button is pressed.
now my problem is : that i want this simple activity with the button to be the start activity
i created the following tags to in the manifest file as follows:
start activity:
and the downloaded zxing project has an activity that always is launched in the beginning and it has the following manifest file:
<activity android:name=".CaptureActivity"
android:screenOrientation="landscape"
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>
<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>
</activity>
Logcat output after changing my activity to be the launcher:
09-20 12:39:57.527: E/AndroidRuntime(22519): FATAL EXCEPTION: main
09-20 12:39:57.527: E/AndroidRuntime(22519): java.lang.RuntimeException: Unable to
resume activity
{com.google.zxing.client.android/com.google.zxing.client.android.Test}:
java.lang.NullPointerException
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.app.ActivityThread.performResumeActivity(ActivityThread.java:2456)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2484)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1998)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.app.ActivityThread.access$600(ActivityThread.java:127)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.os.Handler.dispatchMessage(Handler.java:99)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.os.Looper.loop(Looper.java:137)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.app.ActivityThread.main(ActivityThread.java:4507)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
java.lang.reflect.Method.invokeNative(Native Method)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
java.lang.reflect.Method.invoke(Method.java:511)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
dalvik.system.NativeStart.main(Native Method)
09-20 12:39:57.527: E/AndroidRuntime(22519): Caused by: java.lang.NullPointerException
09-20 12:39:57.527: E/AndroidRuntime(22519): at
com.google.zxing.client.android.CaptureActivity.onResume(CaptureActivity.java:178)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1157)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.app.Activity.performResume(Activity.java:4539)
09-20 12:39:57.527: E/AndroidRuntime(22519): at
android.app.ActivityThread.performResumeActivity(ActivityThread.java:2446)
i just want to know how to make the simple activity i created is the start activity. in other words, where to place the tags of the simple activity in the manifest file of zxing project?
I guess you should remove
from
CaptureActivityin manifest file.and simply add
after the code part you have shown. I had not tried it. Let me know if it works?