UltimateRecyclerView
UltimateRecyclerView copied to clipboard
Viewstub must have a valid layout resource error
I have this error after calling notifydatasetchanged.
try not to using it.
removing notifydatasetchanged, i have the following error: attempt to write to field 'int android.support.v7.widget.RecyclerView$ViewHolder.mItemViewType' on a null object reference
Can be beacuse recyclerview is trying to call setVisibility on ViewStub when ViewStub is not actually inflated? instead build 0.3.18 is working well
Yeah I have the same issue.
I encountered the same issue. Is there any update on this?
I encountered the same error too using compile 'com.hkm.slidingmenulib:libmenu:0.4.9' even when there are data. However, on the older version build like 0.3.18 works well.
04-11 13:13:48.932: E/AndroidRuntime(23408): Caused by: java.lang.IllegalArgumentException: ViewStub must have a valid layoutResource
04-11 13:13:48.932: E/AndroidRuntime(23408): at android.view.ViewStub.inflate(ViewStub.java:289)
04-11 13:13:48.932: E/AndroidRuntime(23408): at android.view.ViewStub.setVisibility(ViewStub.java:240)
04-11 13:13:48.932: E/AndroidRuntime(23408): at com.marshalchen.ultimaterecyclerview.UltimateRecyclerView.updateHelperDisplays(UltimateRecyclerView.java:868)
04-11 13:13:48.932: E/AndroidRuntime(23408): at com.marshalchen.ultimaterecyclerview.UltimateRecyclerView.access$600(UltimateRecyclerView.java:61)
04-11 13:13:48.932: E/AndroidRuntime(23408): at com.marshalchen.ultimaterecyclerview.UltimateRecyclerView$3.onChanged(UltimateRecyclerView.java:823)
04-11 13:13:48.932: E/AndroidRuntime(23408): at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyChanged(RecyclerView.java:9242)
04-11 13:13:48.932: E/AndroidRuntime(23408): at android.support.v7.widget.RecyclerView$Adapter.notifyDataSetChanged(RecyclerView.java:5493)
Have this bug been fixed?
Just found another similar bug, but now it came from removeInternal
4-11 14:08:27.882: E/AndroidRuntime(5283): Caused by: java.lang.IllegalArgumentException: ViewStub must have a valid layoutResource
04-11 14:08:27.882: E/AndroidRuntime(5283): at android.view.ViewStub.inflate(ViewStub.java:289)
04-11 14:08:27.882: E/AndroidRuntime(5283): at android.view.ViewStub.setVisibility(ViewStub.java:240)
04-11 14:08:27.882: E/AndroidRuntime(5283): at com.marshalchen.ultimaterecyclerview.UltimateRecyclerView.updateHelperDisplays(UltimateRecyclerView.java:868)
04-11 14:08:27.882: E/AndroidRuntime(5283): at com.marshalchen.ultimaterecyclerview.UltimateRecyclerView.access$600(UltimateRecyclerView.java:61)
04-11 14:08:27.882: E/AndroidRuntime(5283): at com.marshalchen.ultimaterecyclerview.UltimateRecyclerView$3.onItemRangeRemoved(UltimateRecyclerView.java:811)
04-11 14:08:27.882: E/AndroidRuntime(5283): at android.support.v7.widget.RecyclerView$AdapterDataObservable.notifyItemRangeRemoved(RecyclerView.java:9276)
04-11 14:08:27.882: E/AndroidRuntime(5283): at android.support.v7.widget.RecyclerView$Adapter.notifyItemRemoved(RecyclerView.java:5653)
04-11 14:08:27.882: E/AndroidRuntime(5283): at com.marshalchen.ultimaterecyclerview.UltimateViewAdapter.removeInternal(UltimateViewAdapter.java:429)
04-11 14:08:27.882: E/AndroidRuntime(5283): at sg.ListAdapter.removeItemAt(ListAdapter.java:124)
My adapter have extends UltimateViewAdapter.
It was working fine on 0.3.18 as well.
Hey guys, after looking through the UltimateRecyclerView.java, which i realise that now the structure for the library require the mEmpty to be inflate first and this can be done using the following: ultimateRecyclerView.setEmptyView(R.layout.empty_view, R.id.no_image);
Thus, this helps me to resolve the above issue.
greate!
tnx @lkwjohn "setEmptyView" works
You can also set that in the layout, e.g.:
<com.marshalchen.ultimaterecyclerview.UltimateRecyclerView
...
app:recyclerviewEmptyView="@layout/empty_view"/>
reference: http://blog.marshalchen.com/UltimateRecyclerView/
@jackcsk Emptyview not showing even if I add this in xml or using "setEmptyView" in code, leaving a huge white area on the screen. Any idea on what happened?
@lkwjohn @cymcsg ultimateRecyclerView.setEmptyView(@LayoutRes int emptyResourceId, final int emptyViewPolicy);
after read source code, the second param needs pass a Policy Id I think, but the comment is @param emptyViewPolicy the Resource Id from the empty view is that wrong?