InfoContract | Demo for DApp | Cryptocurrency library
kandi X-RAY | InfoContract Summary
kandi X-RAY | InfoContract Summary
Demo for DApp
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of InfoContract
InfoContract Key Features
InfoContract Examples and Code Snippets
Community Discussions
Trending Discussions on InfoContract
QUESTION
In my activity I am setting ViewPager
,TabLayout
and adding two fragment instance in a list. Then i am passing that list to ViewPagerAdapter
.Responsibility of fragment is to fetch data from api call and show it in a list .
I am taking two instance of fragment because api returns two list of data that need to be show in tab fashion(One list in one tab and one in another). But when viewpager adapter returns fragment , if one data list is empty then I am getting empty screen in Tab-0 .
How to dynamically detect data size (here confused , because need to call fragment) and populate tab based on that.
ActivityOne.kt
...ANSWER
Answered 2020-Jan-06 at 19:16The best option is to fetch data in the activity and then show that tab layout with 2 tabs or just one tab. You would use it with a shared view model, but I see you don't use view models here.
You can also just set the list in createInstance()
method in Fragment when it isn't empty.
The third option is to fetch data in Fragment and then send information to activity that the list is empty and hide the specific tab.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install InfoContract
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page