Android: FragmentPagerAdapter: getItem method called twice on First time

前端 未结 5 1467
一整个雨季
一整个雨季 2020-12-15 04:44

In My application, I have used the ViewPager. Like,

(say main.xml)



        
5条回答
  •  既然无缘
    2020-12-15 04:53

    you can use this method to update your views

    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
    
        if (isVisibleToUser) {
            // Fetch data or something...
        }
    }
    

提交回复
热议问题