title: Why does getActivity of my fragment returns null?
body: <p>I currently have a thread in my main Activity do download stuff frow web and I then need to update the Fragments inside a ViewPager after download finished.</p>
  
  <p>The download is handled by a service and broadcast an Intent when finished.</p>
  
  <p>So, basically, my code in my main Activity is:</p>
  
  <pre><code>public class MyBroadcastReceiver extends BroadcastReceiver {
      @Override
      public void onReceive(Context context, Intent intent) {
          ((PositionFragment)mPagerAdapter.getItem(0)).updateUI();
      }
  }
  </code></pre>
  
  <p>and my PositionFragment:</p>
  
  <pre><code>public void updateUI() {
      mActivity = getActivity();
  </code></pre>
  
  <p>I really don't get how this can be null. This really souds simple, but I must be missing something!</p>
  
  <p>Any idea?</p>
  
  <p>Edit: my Adapter:</p>
  
  <pre><code>public class PageAdapter extends FragmentPagerAdapter {
      private List&lt;Fragment&gt; fragments;
  
      public PageAdapter(FragmentManager fm, List&lt;Fragment&gt; fragments) {
          super(fm);
          this.fragments = fragments;
      }
  
      @Override
      public Fragment getItem(int position) {
          return this.fragments.get(position);
      }
  
      @Override
      public int getCount() {
          return this.fragments.size();
      }
  
      @Override
      public CharSequence getPageTitle(int position) {
          return titles[position];
      }
  }
  </code></pre>