title: Delay onCreateView() of a fragment
body: <p>My code fetches data via loader from the internet, which gets passed into the fragment via bundle and then should be displayed in the fragment's view.</p>
  
  <p>Problem is, that the fragement's <em>onCreateView()</em>-Method get's called, before my data is ready, so the bundles arguments are null.</p>
  
  <p>How can I postpone that process, so the data is ready when <em>onCreateView()</em> gets called?</p>
  
  <p>I try and post just the code necessary, tell me if you need some more.</p>
  
  <p>PS. Originally, I tried to pass the whole <em>List NewsEntry</em> to the fragment, but that failed horribly, so I had to convert it to a StringArray in order to put it in the bundle. If you can tell me a better way to pass this list to the fragment, I'd be very grateful too :)</p>
  
  <p>Thank you</p>
  
  <p><strong>SpinnerActivity.java</strong></p>
  
  <pre><code>@Override
  public void onItemSelected(
          AdapterView&lt;?&gt; parent, 
          View view, 
          int position, 
          long id
  ) {
      mQuery = parent.getItemAtPosition(position).toString();
      buildQuery();
      loaderManager.destroyLoader(0);
      Loader loader = loaderManager.initLoader(0, null, this);
  }
  
  public void onLoadFinished(
          Loader&lt;List&lt;NewsEntry&gt;&gt; loader, 
          List&lt;NewsEntry&gt; fetchedNewsEntries
  ) {
      Bundle bundle = new Bundle();
      ArrayList&lt;String&gt; newsEntriesArrayList = new ArrayList&lt;&gt;();
  
      ...
  
      bundle.putStringArrayList("newsEntries", newsEntriesArrayList);
      NewsEntryFragment fragment = new NewsEntryFragment();
      fragment.setArguments(bundle);
  }
  </code></pre>
  
  <p><strong>NewsEntryFragment.java</strong></p>
  
  <pre><code>public NewsEntryFragment() {}
  
  public static void newInstance(int columnCount) {
  
      NewsEntryFragment fragment = new NewsEntryFragment();
      Bundle args = new Bundle();
      args.putInt(ARG_COLUMN_COUNT, columnCount);
      fragment.setArguments(args);
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      if (getArguments() != null) {
          mColumnCount = getArguments().getInt(ARG_COLUMN_COUNT);
      }
  }
  
  @Override
  public View onCreateView(
          @NonNull LayoutInflater inflater, 
          ViewGroup container,
          Bundle savedInstanceState
  ) {
      View view = inflater.inflate(R.layout.fragment_newsentry_list, container, false);
  
      if (getArguments() != null) {
          ArrayList&lt;String&gt; newsEntriesStringArrayList = 
              new ArrayList&lt;&gt;(
                  Objects.requireNonNull( 
                      getArguments().getStringArrayList( "newsEntries" ) 
                  )
              )
          ;
  
          ArrayList&lt;NewsEntry&gt; newsEntriesArrayList = new ArrayList&lt;&gt;();
              for (int i = 0; i &lt; newsEntriesStringArrayList.size(); i++){
                  StringBuilder builder = new StringBuilder();
                  String sArray[];
                  sArray = newsEntriesStringArrayList.get(i).split(",");
                  NewsEntry newsEntry = 
                      new NewsEntry(
                          sArray[0], 
                          sArray[1], 
                          sArray[2], 
                          sArray[3], 
                          sArray[4]
                      )
                  ;
  
                  newsEntriesArrayList.add(newsEntry);
              }
      }
  
  
      // Set the adapter
      if (view instanceof RecyclerView) {
          Context context = view.getContext();
          RecyclerView recyclerView = (RecyclerView) view;
          if (mColumnCount &lt;= 1) {
              recyclerView.setLayoutManager(new LinearLayoutManager(context));
          } else {
              recyclerView.setLayoutManager(new GridLayoutManager(context, mColumnCount));
          }
          recyclerView
              .setAdapter(
                  new MyNewsEntryRecyclerViewAdapter(
                      mNewsEntries, 
                      mListener
                  )
              )
          ;
      }
      return view;
  }
  
  @Override
  public void onAttach(Context context) {
      super.onAttach(context);
      if (context instanceof OnListFragmentInteractionListener) {
          mListener = (OnListFragmentInteractionListener) context;
      } else {
          throw new RuntimeException(context.toString()
                  + " must implement OnListFragmentInteractionListener");
      }
  }
  </code></pre>
  
  <p><strong>activity_main.xml</strong></p>
  
  <pre><code>    ...
  
      &lt;FrameLayout
      android:id="@+id/main_fragment_holder"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_marginTop="?attr/actionBarSize"&gt;
  
      &lt;fragment android:name="com.example.bjonic.guardiannewsfeed.NewsEntryFragment"
          android:id="@+id/headlines_fragment"
          android:layout_width="match_parent"
          android:layout_height="match_parent" /&gt;
  
  &lt;/FrameLayout&gt;
  </code></pre>