IllegalStateException: ViewStub must have a non-null ViewGroup viewParent
See original GitHub issueHi,
I think you’re setting something null and because of that, Android throws an exception.
The complete trace is:
java.lang.IllegalStateException: ViewStub must have a non-null ViewGroup viewParent
at android.view.ViewStub.inflate(ViewStub.java:292)
at com.marshalchen.ultimaterecyclerview.UltimateRecyclerView.setEmptyView(UltimateRecyclerView.java:183)
at com.collect_up.c_up.fragments.ShopPagerFragment$2.onFailure(ShopPagerFragment.java:145)
at com.collect_up.c_up.helpers.Pagination$5.onFailure(Pagination.java:123)
at com.loopj.android.http.AsyncHttpResponseHandler.handleMessage(AsyncHttpResponseHandler.java:379)
at com.loopj.android.http.AsyncHttpResponseHandler$ResponderHandler.handleMessage(AsyncHttpResponseHandler.java:195)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
The error was thrown because of following line that I’ve set.
mRecyclerView.setEmptyView(R.layout.empty_list_view_cause_get_data_error);
And the used layout content is:
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/coudnt_load_data" />
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
ViewStub must have a non-null ViewGroup viewParent
It inflates correctly the first time but fails the second time citing java.lang.IllegalStateException: ViewStub must have a non-null ViewGroup ...
Read more >ViewStub must have a non-null ViewGroup viewParent
Android – ViewStub must have a non-null ViewGroup viewParent. androidviewstub. I am using ViewStubs to load show data in my layout.
Read more >android 解决java.lang.IllegalStateException:ViewStub ... - 简书
IllegalStateException :ViewStub must have a non-null ViewGroup viewParent android.view.ViewStub.inflate(ViewStub.java:318).
Read more >core/java/android/view/ViewStub.java - Google Git
throw new IllegalStateException("ViewStub must have a non-null ViewGroup viewParent");. } } /**. * Specifies the inflate listener to be notified after this ...
Read more >java.lang.IllegalStateException: ViewStub must have a non ...
java.lang.IllegalStateException: ViewStub must have a non-null ViewGroup viewParent. 暝七夜 于 2020-07-16 15:59:30 发布 1760 收藏. 分类专栏: android bug.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@firasalkafri Not yet 😦 @cymcsg Sir we’re waiting for a big update. I’m using this library inside my very huge project and I really want to see regular updates. Thanks.
@alirezaaa try use
UltimateRecyclerView.getEmptyView()
and remove its children view, then inflate and add your custom view into its parent view