Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressing menu button crashes app #84

Open
linron opened this issue Sep 14, 2018 · 3 comments
Open

Pressing menu button crashes app #84

linron opened this issue Sep 14, 2018 · 3 comments

Comments

@linron
Copy link

linron commented Sep 14, 2018

Pressing the android menu button while the qr code scann is active crashes the app with following error:
ending event: exception on thread: main msg:java.lang.RuntimeException: Expecting menu, got FrameLayout; Titanium 7.1.1,2018/04/19 11:11,undefined
[ERROR] : TiApplication: java.lang.RuntimeException: Expecting menu, got FrameLayout
[ERROR] : TiApplication: at android.view.MenuInflater.parseMenu(MenuInflater.java:144)
[ERROR] : TiApplication: at android.view.MenuInflater.inflate(MenuInflater.java:111)
[ERROR] : TiApplication: at com.google.zxing.client.android.CaptureActivity.onCreateOptionsMenu(CaptureActivity.java:430)
[ERROR] : TiApplication: at android.app.Activity.onCreatePanelMenu(Activity.java:2646)
[ERROR] : TiApplication: at com.android.internal.policy.impl.PhoneWindow.preparePanel(PhoneWindow.java:512)
[ERROR] : TiApplication: at com.android.internal.policy.impl.PhoneWindow.onKeyDownPanel(PhoneWindow.java:901)
[ERROR] : TiApplication: at com.android.internal.policy.impl.PhoneWindow.onKeyDown(PhoneWindow.java:1678)
[ERROR] : TiApplication: at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2196)
[ERROR] : TiApplication: at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4661)
[ERROR] : TiApplication: at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4628)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4193)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4247)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4216)
[ERROR] : TiApplication: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4327)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4224)
[ERROR] : TiApplication: at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4384)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4193)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4247)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4216)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4224)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4193)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4247)
[ERROR] : TiApplication: at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4216)
[ERROR] : TiApplication: at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4360)
[ERROR] : TiApplication: at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:4520)
[ERROR] : TiApplication: at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:2217)
[ERROR] : TiApplication: at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:1864)
[ERROR] : TiApplication: at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:1855)
[ERROR] : TiApplication: at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:2194)
[ERROR] : TiApplication: at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:141)
[ERROR] : TiApplication: at android.os.MessageQueue.nativePollOnce(Native Method)
[ERROR] : TiApplication: at android.os.MessageQueue.next(MessageQueue.java:138)
[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:131)
[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5593)
[ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:515)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
[ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method)

@m1ga
Copy link
Contributor

m1ga commented Sep 14, 2018

do you want to use the menu?
How did you create it? If not you could use allowMenu:false to return out of that function and it won't throw the error.

@linron
Copy link
Author

linron commented Sep 15, 2018

I don't need the menu and also tried to call it with allowMenu:false but it still throws an error.
Barcode.allowMenu = false; Barcode.allowInstructions = false; Barcode.capture({ animate: true, overlay: overlay, showCancel: true, showRectangle: true, keepOpen: false, acceptedFormats: [ Barcode.FORMAT_QR_CODE ] });

@m1ga
Copy link
Contributor

m1ga commented Sep 15, 2018

ok, since it should leave that function:
https://github.com/appcelerator-modules/ti.barcode/blob/master/android/src/com/google/zxing/client/android/CaptureActivity.java#L427
when allowMenu is disabled. I have to check with an emulated menu key since I don't have a phone that still has a menu button :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants