hanggrian / socialview

Android TextView and EditText with hashtag, mention, and hyperlink support
http://hanggrian.com/socialview/
Apache License 2.0
323 stars 81 forks source link

Crash when long click on hashtag or mention. #41

Closed 5mi13 closed 3 years ago

5mi13 commented 6 years ago

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:1084) at android.widget.Editor.performLongClick(Editor.java:1205) at android.widget.TextView.performLongClick(TextView.java:10891) at android.view.View.performLongClick(View.java:6322) at android.view.View$CheckForLongPress.run(View.java:24695) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6665) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)

hanggrian commented 6 years ago

I haven't thought of long click behavior. Let me first know what to do with it.

5mi13 commented 6 years ago

@hendraanggrian For example, you could disable the long click to avoid a failure.

JohnnySun commented 6 years ago

@5mi13 did u found this crash on miui when use miui system bigbong?

JohnnySun commented 6 years ago

I found same stacktrace on the other apps, I think is mini's hook caused this crash

hanggrian commented 5 years ago

@JohnnySun would you mind sharing the stacktrace?

sidhuparas commented 4 years ago

Simply setting this fixed for me:

textView.setOnLongClickListener { return@setOnLongClickListener true }
hanggrian commented 3 years ago

I've tried setOnLongClickListener returning false and true. In both cases, I am unable to replicate the error author has written. And since I don't have access to MIUI devices (as @JohnnySun implies) and this issue's inactivity, I'm closing this issue.