A
A
Alexey2019-08-13 10:51:57
Java
Alexey, 2019-08-13 10:51:57

How to implement side opening child sections of RecyclerView?

I tried to make two parallel recyclerviews, but when you click on an element of the first list, the application crashes with the following error:

2019-08-13 12:50:42.885 8085-8085/ru.retail.app E/AndroidRuntime: FATAL EXCEPTION: main
    Process: ru.retail.app, PID: 8085
    java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.List.add(java.lang.Object)' on a null object reference
        at ru.retail.app.Activity.ProductsActivity.readFileSD(ProductsActivity.java:146)
        at ru.retail.app.adapter.ProductsActivity_CategoriesRecyclerViewAdapter.openCategory(ProductsActivity_CategoriesRecyclerViewAdapter.java:64)
        at ru.retail.app.adapter.ProductsActivity_CategoriesRecyclerViewAdapter.access$600(ProductsActivity_CategoriesRecyclerViewAdapter.java:21)
        at ru.retail.app.adapter.ProductsActivity_CategoriesRecyclerViewAdapter$categoriesButtonListener.onClick(ProductsActivity_CategoriesRecyclerViewAdapter.java:146)
        at android.view.View.performClick(View.java:5675)
        at android.view.View$PerformClick.run(View.java:22641)
        at android.os.Handler.handleCallback(Handler.java:836)
        at android.os.Handler.dispatchMessage(Handler.java:103)
        at android.os.Looper.loop(Looper.java:203)
        at android.app.ActivityThread.main(ActivityThread.java:6251)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)

although, if both recyclerviews display the same list list, then everything is ok. Surely it can be implemented through one recyclerview, but I have no idea how to do it from the side. If anyone has come across this issue, please give me some ideas.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question