Using EpoxyRecyclerView inside of ViewPager
@Override
public Object instantiateItem(ViewGroup collection, int position) {
LayoutInflater inflater = LayoutInflater.from(mContext);
ViewGroup layout = (ViewGroup) inflater.inflate(idLists.get(position), collection, false);
collection.addView(layout);
splitRecyclerView = (EpoxyRecyclerView) layout.findViewById(R.id.split_recycler_view);
splitRecyclerView.setLayoutManager(new LinearLayoutManager(this.mContext));
splitRecyclerView.setController(controller);
updateController(position);
return layout;
}
Error:
09-03 22:54:36.394 23354-23354/com.milcgroup.one E/AndroidRuntime: FATAL EXCEPTION: main Process: com.milcgroup.one, PID: 23354 java.lang.IllegalStateException: This EpoxyController had its adapter added to more than one ReyclerView. Epoxy does not support attaching an adapter to multiple RecyclerViews because saved state will not work properly. If you did not intend to attach your adapter to multiple RecyclerViews you may be leaking a reference to a previous RecyclerView. Make sure to remove the adapter from any previous RecyclerViews (eg if the adapter is reused in a Fragment across multiple onCreateView/onDestroyView cycles). See https://github.com/airbnb/epoxy/wiki/Avoiding-Memory-Leaks for more information. at com.airbnb.epoxy.EpoxyController$3.run(EpoxyController.java:690) at android.os.Handler.handleCallback(Handler.java:790) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)