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

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -