etsy / AndroidStaggeredGrid

An Android staggered grid view which supports multiple columns with rows of varying sizes.
https://github.com/etsy/AndroidStaggeredGrid
4.76k stars 1.13k forks source link

NullPointerException on LongClick in Edittext #186

Open 9to6 opened 9 years ago

9to6 commented 9 years ago
  1. add header view

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/red">

<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~

rajtrivedi88 commented 7 years ago

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.