saket / Better-Link-Movement-Method

Attempts to improve how clickable links are detected, highlighted and handled in TextView
Apache License 2.0
783 stars 77 forks source link

ActivityNotFoundException / BetterLinkMovementMethod#dispatchUrlClick #39

Closed johnjohndoe closed 1 year ago

johnjohndoe commented 4 years ago

Recently, I noticed the following crash being reported in the Google Play Developer Console for an Android app of mine. Are you aware of an issue here?

Environment

Stacktrace

android.content.ActivityNotFoundException: 
  at android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:1622)
  at android.app.Instrumentation.execStartActivity (Instrumentation.java:1417)
  at android.app.Activity.startActivityForResult (Activity.java:3370)
  at androidx.fragment.app.FragmentActivity.startActivityForResult (FragmentActivity.java:675)
  at android.app.Activity.startActivityForResult (Activity.java:3331)
  at androidx.fragment.app.FragmentActivity.startActivityForResult (FragmentActivity.java:662)
  at android.app.Activity.startActivity (Activity.java:3566)
  at android.app.Activity.startActivity (Activity.java:3534)
  at android.content.ContextWrapper.startActivity (ContextWrapper.java:284)
  at android.text.style.URLSpan.onClick (URLSpan.java:62)
  at me.saket.bettermovementmethod.BetterLinkMovementMethod.dispatchUrlClick (BetterLinkMovementMethod.java:392)
  at me.saket.bettermovementmethod.BetterLinkMovementMethod.onTouchEvent (BetterLinkMovementMethod.java:248)
  at android.widget.TextView.onTouchEvent (TextView.java:7536)
  at android.view.View.dispatchTouchEvent (View.java:7246)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:1917)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:1917)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:1917)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:1917)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:1917)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:1917)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:1917)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:1917)
  at android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2174)
  at android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:1917)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent (PhoneWindow.java:1953)
  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1405)
  at android.app.Activity.dispatchTouchEvent (Activity.java:2410)
  at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:69)
  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent (PhoneWindow.java:1901)
  at android.view.View.dispatchPointerEvent (View.java:7426)
  at android.view.ViewRootImpl.deliverPointerEvent (ViewRootImpl.java:3220)
  at android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:3165)
  at android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:4292)
  at android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:4271)
  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:4363)
  at android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:179)
  at android.os.MessageQueue.nativePollOnce (MessageQueue.java)
  at android.os.MessageQueue.next (MessageQueue.java:125)
  at android.os.Looper.loop (Looper.java:124)
  at android.app.ActivityThread.main (ActivityThread.java:5041)
  at java.lang.reflect.Method.invokeNative (Method.java)
  at java.lang.reflect.Method.invoke (Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:793)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:560)
  at dalvik.system.NativeStart.main (NativeStart.java)
saket commented 4 years ago

I don't think so. This library doesn't control the behavior of URLSpan#onClick. I'm pretty sure you'll get the same crash with LinkMovementMethod.