title: ViewPagerIndicator, Fragments with heavy content, how to manage loading
body: <p>I use ViewPagerindicator with Tabs to display my content. The thing is, that my Fragments have heavy views which takes a lot of time to generate them because of many elements and pictures. I would like to display a progressbar while loading, but how to manage it? In my test instance(TestFragment) I have this method with many many textViews (it simulates the reality):</p>
  
  <pre><code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  
  
          LinearLayout layout = new LinearLayout(getActivity());
          layout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
          layout.setGravity(Gravity.CENTER);
          for (int a=0; a &lt; 1000; a++) layout.addView(createTextView());
  
          return layout;
      }
  </code></pre>
  
  <p>In my pager adapter I could load all fragment once to avoid waiting for fragments while changing pages:</p>
  
  <pre><code> ViewPager pager = (ViewPager)findViewById(R.id.pager);
   pager.setAdapter(adapter);
   pager.setOffscreenPageLimit(5);
  </code></pre>
  
  <p>but I do not know, how could I manage that all fragments where loaded? As they all are loaded each after another in the adapter:</p>
  
  <pre><code>  public Fragment getItem(int position) {
     return TestFragment.newInstance(position);
    }
  </code></pre>
  
  <p>any ideas? </p>