title: Running a Gallery after Loading Screen Completes loading
body: <p>I am currently new to Android. I have seen many cases whereby a loading screen is able to initiate the downloading of files. I would like to know how is it possible for me to initiate the gallery on the postexecute() command when the loading screen has finished processing its background task. 
  The following is the code in the background task. Am i suppose to write codes inside this background for the gallery to execute on the postexecute() or is there any way else i can do this. </p>
  
  <p>P.S My Loading screen and the gallery are on different java files. So is there any way i can allow the gallery to run right after the loading screen on the postexecute command?</p>
  
  <p>Thanks</p>
  
  <pre><code>  //The code to be executed in a background thread.
              @Override
              protected String doInBackground(String... strings) 
              {
                  /* This is just a code that delays the thread execution 4 times, 
                   * during 850 milliseconds and updates the current progress. This 
                   * is where the code that is going to be executed on a background
                   * thread must be placed. 
                   */
                  try 
                  {
                      //Get the current thread's token
                      synchronized (this) 
                      {
                          //Initialize an integer (that will act as a counter) to zero
                          int counter = 0;
                          //While the counter is smaller than four
                          while(counter &lt;= 4)
                          {
                              //Wait 850 milliseconds
                              this.wait(850);
                              //Increment the counter 
                              counter++;
                              //Set the current progress. 
                              //This value is going to be passed to the onProgressUpdate() method.
                              publishProgress(counter*25);
                          }
                      }
                  } 
                  catch (InterruptedException e) 
                  {
                      e.printStackTrace();
                  }
                  return null;
              }
  
              //Update the TextView and the progress at progress bar
              @Override
              protected void onProgressUpdate(Integer... values) 
              {
                  //Update the progress at the UI if progress value is smaller than 100
                  if(values[0] &lt;= 100)
                  {
                      tv_progress.setText("Progress: " + Integer.toString(values[0]) + "%");
                      pb_progressBar.setProgress(values[0]);
                  }
              }
  </code></pre>