title: ViewPager doesn't show first fragment, if its contents are loaded dynamically
body: <p>I am facing a very strange issue, while building a viewPager with fragments in android application. I have an activity, that builds the layout and two fragments: each of them contains RecyclerView and loads its contents dynamically from the server. When I've tested it with static content of the Fragments everything works just great, but as I switch to pre-tested and working dynamic-content Fragments, the ViewPager never loads the first one, only the second. If I swap them, the viewPager still loads only the second one. In the first Tab I always see only a white blank field. 
  Any help will be appreciated.</p>
  
  <p>The activity part:</p>
  
  <pre><code>    tabLayout = (TabLayout) findViewById(R.id.contacts_tabs_layout);
      adapter = new ContactsPagerAdapter(getSupportFragmentManager());
  
      viewPager.setAdapter(adapter);
      tabLayout.setupWithViewPager(viewPager);
  </code></pre>
  
  <p>The activity layout :</p>
  
  <pre><code>&lt;android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;android.support.design.widget.AppBarLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
  
      &lt;android.support.v7.widget.Toolbar
          android:id="@+id/toolbar_parent"
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize" /&gt;
  
      &lt;android.support.design.widget.TabLayout
          android:id="@+id/contacts_tabs_layout"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          app:tabMaxWidth="0dp"
          app:tabGravity="fill"
          app:tabMode="scrollable"&gt;
  
      &lt;/android.support.design.widget.TabLayout&gt;
  &lt;/android.support.design.widget.AppBarLayout&gt;
  
  &lt;android.support.v4.view.ViewPager
      android:id="@+id/view_pager_contacts_list"
      android:layout_width="match_parent"
      android:layout_height="fill_parent"
      app:layout_behavior="@string/appbar_scrolling_view_behavior" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>The fragment layout:</p>
  
  <p><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/contacts_list"
      android:layout_width="fill_parent"
      android:layout_height="match_parent" /&gt;
  </code></p>
  
  <p>The fragment's relevant code:</p>
  
  <pre><code> contactsList = (RecyclerView) v.findViewById(R.id.contacts_list);
      contactsList.setLayoutManager(new LinearLayoutManager(getActivity()));
      adapter = new ContactsListAdapter(getActivity());
      contactsList.setAdapter(adapter);
  
  
      controller.getContacts(new CommunicationListener() {
          @Override
          public void onFileReceived(FilePath filePath, byte[] data) {
              System.out.println("RECEIVED CONTACTS DATA FILE WITH SIZE OF " + data.length);
              final Contact c = Utils.deserializeContact(data);
  
              new Handler(Looper.getMainLooper()).post(new Runnable() {
                  @Override
                  public void run() {
                      adapter.add(c);
                  }
              });
          }
      });
      return v;
  </code></pre>
  
  <p>The adapter's part:</p>
  
  <pre><code> public ContactsPagerAdapter(FragmentManager fragmentManager) {
      super(fragmentManager);
  
  }
  
  
  @Override
  public Fragment getItem(int position)
  {
      switch(position){
          case 0:
              return new ContactsListFragment();
          case 1:
              return new TestFragment();
          default:
              return null;
      }
  }
  
  @Override
  public int getItemPosition(Object object) {
      return POSITION_NONE;
  }
  
  @Override
  public int getCount() {
      return 2;
  }
  </code></pre>