I've a TextView in my app where every word is a clickable span. Everything works fine until I long click any word, which throws the following exception:
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.widget.Editor$SelectionModifierCursorController.getMinTouchOffset()' on a null object reference
at android.widget.Editor.touchPositionIsInSelection(Editor.java:917)
at android.widget.Editor.performLongClick(Editor.java:1018)
at android.widget.TextView.performLongClick(TextView.java:9436)
at android.view.View.performLongClick(View.java:5700)
at android.view.View$CheckForLongPress.run(View.java:22431)
at android.os.Handler.handleCallback(Handler.java:754)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6372)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:791)
I've tried setting android:longClickable="false" on the TextView but in vain. Any idea how it can be fixed?
Thanking in anticipation!