title: How to add real Loading Screen
body: <p>I have an android application of a pdf file inside. When I open my application on lower configuration devices (galaxy 2 etc.), it takes a while to load the PDF file. I tried to adding a splash screen in my application but when opening <code>MainActivity.class</code> after <code>SplashScreen</code> still taking same time. How can I develop a real loading screen? It should work on top of <code>Main Activity</code> layer.
  <strong>Here my codes:</strong></p>
  
  <blockquote>
    <p><strong>AndroidManifest.xml</strong></p>
  </blockquote>
  
  <pre><code>        &lt;activity
              android:name=".SplashScreen"
              android:label="@string/app_name"
              android:theme="@style/AppTheme.NoActionBar"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity android:name=".MainActivity"&gt;&lt;/activity&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <blockquote>
    <p><strong>SplashScreen.class</strong></p>
  </blockquote>
  
  <pre><code>public class SplashScreen extends AppCompatActivity {
      private GifImageView gifImageView;
      private ProgressBar progressBar;
      Handler handler;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_splash_screen);
  
          gifImageView=(GifImageView)findViewById(R.id.gifview);
          progressBar=(ProgressBar)findViewById(R.id.progressbar);
          progressBar.setVisibility(progressBar.VISIBLE);
  
          try {
              InputStream inputStream = getAssets().open("loading.gif");
              byte[] bytes  = IOUtils.toByteArray(inputStream);
              gifImageView.setBytes(bytes);
              gifImageView.startAnimation();
          }
          catch (IOException ex)
          {
          }
  
          new Handler().postDelayed(new Runnable() {
              @Override
              public void run() {
  
                      Intent intent = newIntent(SplashScreen.this,MainActivity.class);
                      SplashScreen.this.startActivity(intent);
                      SplashScreen.this.finish();
              }
          },12000);
      }
  }
  </code></pre>
  
  <p><strong>Here my codes how I can solve this problem?</strong></p>