Pasting into native.TextBox on Samsung causes crash

Hi,

In my latest build I used Corona Native 3121 and my Samsung users have been complaining about a crash when attempting to paste into native.TextBox. Most of them are on Android 7.0.

I did not have this issue before when building with Corona Enterprise 3062.

Does anyone have any idea why this error is happening now? I’ve been getting quite a few bad reviews lately due to this issue so any help would be fantastic.

This are the error messages:

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.widget.Editor$SelectionModifierCursorController.isDragAcceleratorActive()' on a null object reference at android.widget.Editor.updateFloatingToolbarVisibility(Editor.java:1551) at android.widget.Editor.onTouchEvent(Editor.java:1497) at android.widget.TextView.onTouchEvent(TextView.java:10069) at android.view.View.dispatchTouchEvent(View.java:10775) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2865) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2550) at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:583) at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1885) at android.app.Activity.dispatchTouchEvent(Activity.java:3240) at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:545) at android.view.View.dispatchPointerEvent(View.java:11004) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:5152) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:5004) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4529) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4582) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4548) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4681) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4556) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4738) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4529) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4582) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4548) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4556) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4529) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:7050) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6975) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6936) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:7160) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method) at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176) at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:7124) at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:7187) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:959) at android.view.Choreographer.doCallbacks(Choreographer.java:734) at android.view.Choreographer.doFrame(Choreographer.java:664) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:945) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6776) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

Does this happen on any of your testing devices? Is it isolated to Samsung running Android 7.x? Or other manufacturers running 7.x?

Can you paste your basic code for the native input box here so we can inspect?

Thanks,

Brent

Hi Brent,

Yes, this happens when I test on my Samsung S8 with Android 7.0. I’ve only gotten reports of it happening on Samsung devices, also running Android 6.x.

Here is my native.TextBox creation:

main\_text = native.newTextBox(252/2, -3/2, display.contentWidth - 150, keyboardTop - defaultMainTextHeight) main\_text.isEditable = true main\_text.hasBackground = false main\_text.font = native.newFont(native.systemFont, 17)

I do have code that updates the text box’s position and height when the keyboard height changes. I know Samsung changes the keyboard’s height when copying and pasting. Perhaps that could be related to the issue? Again, this issue didn’t occur with building with Corona Enterprise 3062.

Here is the basic code that does that:

local function layoutBasedOnHeight() main\_text.height = keyboardTop - defaultMainTextHeight --defaultMainTextHeight is just a constant if \_G.isAndroid then --for Android main\_text.y = 7/2 + (keyboardTop - defaultMainTextHeight)/2 else --for iOS main\_text.y = -3/2 + (keyboardTop - defaultMainTextHeight)/2 end end local function keyboardHeightChange\_lis( event ) keyboardTop = display.contentHeight - event.newHeight layoutBasedOnHeight() end Runtime:addEventListener("keyboardHeightChange", keyboardHeightChange\_lis)

Do you think it could be related to the keyboard height listener?

Hmm, maybe it’s not related to the keyboard height listener. When I commented it out, it still crashes…

Still at a loss - any help is appreciated!

Hi,

Could you create a very basic test project for this so I can file a bug with engineering?

Thanks,

Brent

Actually we received a similar report according to this forum post, so no need to file a new case, we’ll just explore the existing one…

https://forums.coronalabs.com/topic/70308-textfield/

Hi, just wondering if there is any progress or update to this bug. Thanks!

Hello, any chance this bug will be resolved soon? I’m very stuck since my app is getting bad reviews and lots of emails because of this issue, and I can’t build with an older version of Corona Enterprise to fix it since Enterprise is no longer authorized. If it won’t be fixed soon, is it possible to somehow reactivate an older version of Enterprise?

Thank you.

The issue has been solved in Corona 2017.3156, just tested it!

Fantastic! Thanks!

Is anybody still working on this issue? I’ve tried with 2017.3156 and newer daily builds too, but not having any luck. This is happening to me and several others: https://forums.coronalabs.com/topic/70501-copypaste-does-not-work-on-my-android-device/

I’ll bring it up with our Engineers again. Might be a different issue.

Rob

Does this happen on any of your testing devices? Is it isolated to Samsung running Android 7.x? Or other manufacturers running 7.x?

Can you paste your basic code for the native input box here so we can inspect?

Thanks,

Brent

Hi Brent,

Yes, this happens when I test on my Samsung S8 with Android 7.0. I’ve only gotten reports of it happening on Samsung devices, also running Android 6.x.

Here is my native.TextBox creation:

main\_text = native.newTextBox(252/2, -3/2, display.contentWidth - 150, keyboardTop - defaultMainTextHeight) main\_text.isEditable = true main\_text.hasBackground = false main\_text.font = native.newFont(native.systemFont, 17)

I do have code that updates the text box’s position and height when the keyboard height changes. I know Samsung changes the keyboard’s height when copying and pasting. Perhaps that could be related to the issue? Again, this issue didn’t occur with building with Corona Enterprise 3062.

Here is the basic code that does that:

local function layoutBasedOnHeight() main\_text.height = keyboardTop - defaultMainTextHeight --defaultMainTextHeight is just a constant if \_G.isAndroid then --for Android main\_text.y = 7/2 + (keyboardTop - defaultMainTextHeight)/2 else --for iOS main\_text.y = -3/2 + (keyboardTop - defaultMainTextHeight)/2 end end local function keyboardHeightChange\_lis( event ) keyboardTop = display.contentHeight - event.newHeight layoutBasedOnHeight() end Runtime:addEventListener("keyboardHeightChange", keyboardHeightChange\_lis)

Do you think it could be related to the keyboard height listener?

Hmm, maybe it’s not related to the keyboard height listener. When I commented it out, it still crashes…

Still at a loss - any help is appreciated!

Hi,

Could you create a very basic test project for this so I can file a bug with engineering?

Thanks,

Brent

Actually we received a similar report according to this forum post, so no need to file a new case, we’ll just explore the existing one…

https://forums.coronalabs.com/topic/70308-textfield/

Hi, just wondering if there is any progress or update to this bug. Thanks!

Hello, any chance this bug will be resolved soon? I’m very stuck since my app is getting bad reviews and lots of emails because of this issue, and I can’t build with an older version of Corona Enterprise to fix it since Enterprise is no longer authorized. If it won’t be fixed soon, is it possible to somehow reactivate an older version of Enterprise?

Thank you.

The issue has been solved in Corona 2017.3156, just tested it!