android - In custom LayoutManager (extends RecyclerView.LayoutManager) RecyclerView.getChildViewHolderInt NullPointerException issue -
after trying similar (simplify version):
@override public void onlayoutchildren(recyclerview.recycler recycler, recyclerview.state state) { .... addview(new textview(mrecyclerview.getcontext())) }
i have exception:
java.lang.nullpointerexception @ android.support.v7.widget.recyclerview.getchildviewholderint(recyclerview.java:2497) @ android.support.v7.widget.recyclerview$layoutmanager.addviewint(recyclerview.java:4807) @ android.support.v7.widget.recyclerview$layoutmanager.addview(recyclerview.java:4803) @ android.support.v7.widget.recyclerview$layoutmanager.addview(recyclerview.java:4791)
i can't add recyclerview child view without viewholder?
new children should never added recyclerview directly in layout manager. views adds should obtained attached recyclerview.adapter, accounted , have valid viewholder attached.
Comments
Post a Comment