etsy/AndroidStaggeredGrid

NullPointerException on LongClick in Edittext

9to6 opened this issue · 1 comments

9to6 commented
  1. add header view

<EditText
    android:id="@+id/txt_title"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:layout_weight="1"
    android:gravity="center" />

image

  1. Long Click in EditText
  2. throw Exception.

java.lang.NullPointerException
at android.widget.AbsListView.showContextMenuForChild(AbsListView.java:2891)
at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:647)
at android.view.ViewGroup.showContextMenuForChild(ViewGroup.java:647)
at android.view.View.showContextMenu(View.java:4310)
at android.view.View.performLongClick(View.java:4279)
at android.widget.TextView.performLongClick(TextView.java:8250)
at android.view.View$CheckForLongPress.run(View.java:17700)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)

my env
ANDROID_BUILD_MIN_SDK_VERSION=15
ANDROID_BUILD_TARGET_SDK_VERSION=21
ANDROID_BUILD_TOOLS_VERSION=21.1.2
ANDROID_BUILD_SDK_VERSION=21

thz~

I got the same issue.I could fix this by setting font of the view(Editext/Textview) programmatically instead of XML.Please note that for me it was only happening on lollipop versions of Samsung reported by crashlytics.