Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell when the viewpager is done loading

I am using a ViewPager in my app.

My ViewPager is loading a lot of data and it is talking some time until it shows any content. My question is this: How can I tell that the ViewPager is done loading (about to show its content on screen) so I can remove the loading progressbar?

Thanks!

like image 367
roiberg Avatar asked Jul 27 '13 09:07

roiberg


1 Answers

Try removing your Progressbar on your adapter getItem() call back function when you are returning your last page Fragment :

@Override
    public Fragment getItem(int position) {
        TabInfo info = mTabs.get(position);
        Fragment InsantiatedFragment =  Fragment.instantiate(mContext, info.clss.getName(), info.args);

        if(InsantiatedFragment.getId() == 5) // your last page Id
        {
            //remove your progressbar here
        }

        return InsantiatedFragment;


    }
like image 162
Arash GM Avatar answered Oct 07 '22 06:10

Arash GM