Titanium JIRA Archive
Appcelerator Community (AC)

[AC-2168] longpress on textfield crashes in android

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionCannot Reproduce
Resolution Date2014-01-23T06:43:49.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
Reportergrebulon
AssigneeRitu Agrawal
Created2014-01-12T14:13:15.000+0000
Updated2016-03-08T07:41:09.000+0000

Description

This is app.js {noformat} (function() { var window = Ti.UI.createWindow({exitOnClose:true}); var textField = Ti.UI.createTextField({top: 80, left: 10, right: 10, height: 200}); window.add(textField); window.open(); })(); {noformat} Just put some text in the textField and long press on it. This is the stack dump: {noformat} [ERROR] TiApplication: (main) [95140,126429] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.2.1,2014/01/12 10:24,84d47ff [ERROR] TiApplication: java.lang.NullPointerException [ERROR] TiApplication: at android.widget.Editor$NewActionPopupWindow.show(Editor.java:4145) [ERROR] TiApplication: at android.widget.Editor$HandleView.showNewActionPopupWindow(Editor.java:4550) [ERROR] TiApplication: at android.widget.Editor$SelectionModifierCursorController.initHandles(Editor.java:5503) [ERROR] TiApplication: at android.widget.Editor$SelectionModifierCursorController.show(Editor.java:5437) [ERROR] TiApplication: at android.widget.Editor.startSelectionActionMode(Editor.java:1916) [ERROR] TiApplication: at android.widget.Editor.performLongClick(Editor.java:1125) [ERROR] TiApplication: at android.widget.TextView.performLongClick(TextView.java:8983) [ERROR] TiApplication: at android.view.View$CheckForLongPress.run(View.java:18329) [ERROR] TiApplication: at android.os.Handler.handleCallback(Handler.java:730) [ERROR] TiApplication: at android.os.Handler.dispatchMessage(Handler.java:92) [ERROR] TiApplication: at android.os.Looper.loop(Looper.java:137) [ERROR] TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5368) [ERROR] TiApplication: at java.lang.reflect.Method.invokeNative(Native Method) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Method.java:525) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1041) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857) [ERROR] TiApplication: at dalvik.system.NativeStart.main(Native Method) {noformat}

Comments

  1. Ritu Agrawal 2014-01-14

    I tried this test case on Samsung Galaxy Nexus device and I am unable to reproduce it. Call stack indicates that it is a native Android exception so it may be specific to a particular device. Would you be able to test it on a different device?
  2. grebulon 2014-01-21

    Couldn't reproduce with Samsung Note (1) running CM9.
  3. Andres 2014-10-15

    I reproduce the bug on a Nexus 7 2nd Gen, and I got this message on the dbms: 10-15 12:05:14.453: E/RichInputConnection(783): Unable to connect to the editor to retrieve text. The solution I found is to override the 'longclick' listener for the TextField: textFieldName.addEventListener('longclick', function(e){ Ti.API.info('Anything you want to control'); }); And the listener prevents the crash on Android textFields, the issue can't be reproduced on iOS.
  4. Andres 2014-10-20

    Another workaround is to define the android windowActionBar to false, with this, when we perform a longpress event on the text field will display the action bar and that prevent the bug.

JSON Source