title: How do I implement a spinning ProgressBar on a AsyncTask while the data is loading?
body: <p>Let's say I have this code: </p>
  
  <p>XML</p>
  
  <pre><code> &lt;FrameLayout android:layout_height="match_parent"
      android:layout_width="match_parent"
      xmlns:android="http://schemas.android.com/apk/res/android" &gt;
  
      &lt;android.support.v7.widget.RecyclerView
          android:id="@+id/photo_recycler_view"
          android:layout_width="match_parent"
          android:layout_height="match_parent"/&gt;
  
   &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>Program</p>
  
  <pre><code>  private class FetchItemsTask extends AsyncTask&lt;Void, Void, List&lt;GalleryItem&gt;&gt; {
      private String mQuery;
  
  
      public FetchItemsTask(String query) {
          mQuery = query;
      }
      @Override
      protected List&lt;GalleryItem&gt; doInBackground(Void... params) {
          if (mQuery == null) {
              return new FlickrFetchr().fetchRecentPhotos();
          } else {
              return new FlickrFetchr().searchPhotos(mQuery);
          }
      }
  
  
      @Override
      protected void onPostExecute(List&lt;GalleryItem&gt; galleryItems) {
          mItems = galleryItems;
          setupAdapter();
  
      }
  }
  </code></pre>
  
  <p>How do I implement a spinning ProgressBar and hide the RecyclerView while the AsycnTask does its work in the background? Sorry if this seems like a simple question, but the only answers that I've found use ProgressDialog, which is deprecated as of API 26. Thank you in advance.</p>