Anko-ExpandableTextView
Anko-ExpandableTextView copied to clipboard
NPE when scrolling recyclerview
I have a NPE when scrolling a recyclerview with ExpandableTextView in items
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.text.Layout.getEllipsisCount(int)' on a null object reference
at tm.charlie.expandabletextview.ExpandableTextView.updateState(ExpandableTextView.kt:349)
at tm.charlie.expandabletextview.ExpandableTextView.updateState$default(ExpandableTextView.kt:51)
at tm.charlie.expandabletextview.ExpandableTextView$onTextChanged$1.run(ExpandableTextView.kt:267)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:234)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Here the layout of the item:
<tm.charlie.expandabletextview.ExpandableTextView
android:id="@+id/textview_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:etv_animationDuration="200"
app:etv_collapsedLines="3" />
@arslancharyev31 any idea? The bug appears on a OnePlus X, and Sony Xperia
@jcholin Honestly, haven't tested it with RecyclerView yet. Would you be kind enough to share your recycler view snippet (if possible, with activity) reproducing the NPE? Are you inflating xml from Java? Kotlin?