title: Splash Screen synchronized loading
body: <p>I have implemented a loading screen (splashScreen) but want it to synchronize it with my actual app loading. I want the app to load the main page in the background so when it is done with the timed load on my loading screen, it will already have the main screen pulled up in the background. I am relatively new to Async task and threads since I don't do much apps with games but could use some help with this. Thanks</p>
  
  <p>Canvas Load Bar movement:</p>
  
  <pre><code>public class CustomRectangle extends View{
  
  float left = 0, right = 500, top = 500, bot = 1000;
  boolean check = false, finish = false;
  int screenWidth = 0, screenHeight = 0;
  Bitmap image;
  
  @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
  public CustomRectangle(Context context){
      super(context);
  
      WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
      Display display = wm.getDefaultDisplay();
  
      Point size = new Point();
      display.getSize(size);
  
      this.screenHeight = size.y;
      this.screenWidth = size.x;
  
      this.image = BitmapFactory.decodeResource(getResources(), R.drawable.logo);
      this.image = Bitmap.createScaledBitmap(this.image, screenWidth, screenHeight, false);
  
  }
  @TargetApi(Build.VERSION_CODES.KITKAT)
  @Override
  protected void onDraw(Canvas canvas) {
      super.onDraw(canvas);
  
      if(check == false) {
          Paint paintInitial = new Paint();
          paintInitial.setColor(Color.YELLOW);
          this.left = 0;
          this.top = canvas.getHeight() - 10;
          this.right = canvas.getWidth();
          this.bot = canvas.getHeight();
          canvas.drawRect(left, top - 10, right, bot, paintInitial);
          this.check = true;
      }
      if(check == true &amp;&amp; finish == false) {
          Paint paintWhite = new Paint();
          paintWhite.setColor(Color.WHITE);
          Paint paintYellow = new Paint();
          paintYellow.setColor(Color.YELLOW);
          canvas.drawRect(left, top, right, bot, paintYellow);
          canvas.drawBitmap(image, 0, 0, null);
          top = top - 5;
          invalidate();
          if(top &lt;= 0){
              finish = true;
              Intent intent = new Intent(getContext(), Home_Page.class);
              getContext().startActivity(intent);
              Log.e("", "Finished Loading!");
  
          }
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Splash Screen Activity:</p>
  
  <pre><code>public class SplashScreen extends ActionBarActivity {
  
  Rect loadBar;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(new CustomRectangle(this));
  
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>As of now, the bar loads up to the top of the screen and then starts the main activity but I don't think the main screen loads til the end so this doesn't actually load synchronously. If someone could lead me in the right direction to examples or post a revised code, that would be great. </p>