Materialdrawer: Unable to customize the SecondaryDrawer view

Created on 2 Sep 2019  路  5Comments  路  Source: mikepenz/MaterialDrawer

I am trying to customize the secondary drawer using a separate class. But I am experiencing a crash. Please refer to the crash log attached below. Please help if possible

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.samsung.android.spaytouch.debug, PID: 11474
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setVisibility(int)' on a null object reference
at com.mikepenz.materialdrawer.model.PrimaryDrawerItem.bindView(PrimaryDrawerItem.java:78)
at com.mikepenz.materialdrawer.model.PrimaryDrawerItem.bindView(PrimaryDrawerItem.java:18)
at com.mikepenz.fastadapter.FastAdapter$OnBindViewHolderListenerImpl.onBindViewHolder(FastAdapter.java:1662)
at com.mikepenz.fastadapter.FastAdapter.onBindViewHolder(FastAdapter.java:496)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6781)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6823)
at android.support.v7.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:5752)
at android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6019)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5858)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5854)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2230)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1557)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1517)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:612)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3924)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3641)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:4194)
at android.view.View.layout(View.java:22406)

Related Bugs

https://github.com/mikepenz/MaterialDrawer/issues/2318

question

All 5 comments

@DarrelAeturnum if you modify the layout then ensure that all views and all ids are still present.

Otherwise follow the instructions on how to implement a custom drawerItem.

There is no really need to overwrite a layout for the provided items. Just implement a full custom item.

An item just requires to implement the IDrawerItem interface

Thanks @mikepenz. Can you provide a sample or step guide to implement a custom drawer item?, I actually created a custom PrimaryDrawerItem class by extending BasePrimaryDrawerItem class. But I am having issues in creating the custom SecondaryDrawerItem class.

It worked. Thanks @mikepenz . Is it possible to align the secondary options to align to the bottom of the screen ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlexMercier picture AlexMercier  路  3Comments

hosseiniSeyRo picture hosseiniSeyRo  路  3Comments

pranjal-joshi picture pranjal-joshi  路  3Comments

jd-alexander picture jd-alexander  路  4Comments

GutoMartins019 picture GutoMartins019  路  4Comments