title: android: Instantly start an activity and then load content
body: <p>I've looked into other questions, blogs and the documention and can't seem to find the right answer to my needs.
  I have two activities, A and B. When I start activity B (from A) I want it to open instantly and then load all the content while showing a progress bar, instead of only opening the activity when the content is loaded, making it seem like it froze for two seconds.
  An exemple would be the Youtube app or the Play Store.</p>
  
  <p><strong>That's what i got:</strong></p>
  
  <pre><code>Button.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent goB = new intent(ActivityA.this, ActivityB.class);
              startActivity(goB);
          }
      });
  </code></pre>
  
  <p><strong>This is the activity I'm loading:</strong></p>
  
  <pre><code>public class ActivityB extends AppCompatActivity implements OnDateSelectedListener, OnMonthChangedListener {
  
      private static final DateFormat FORMATTER = SimpleDateFormat.getDateInstance();
  
      @Bind(R.id.calendarView) MaterialCalendarView widget;
      @Bind(R.id.textView) TextView textView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_c_calendar);
          ButterKnife.bind(this);
          widget.setOnDateChangedListener(this);
          widget.setOnMonthChangedListener(this);
          textView.setText(getSelectedDatesString());
  
      }
  
      @Override
      public void onDateSelected(@NonNull MaterialCalendarView widget, @Nullable CalendarDay date, boolean selected) {
          textView.setText(getSelectedDatesString());
      }
  
      private String getSelectedDatesString() {
          CalendarDay date = widget.getSelectedDate();
          if (date == null) {
              return "No Selection";
          }
          return FORMATTER.format(date.getDate());
      }
  
      @Override
      public void onMonthChanged(MaterialCalendarView widget, CalendarDay date) {
  
      }
  
  }
  </code></pre>
  
  <p>I'm not an expert, so detailed explanations will be welcomed.</p>
  
  <p>Note: What I'm loading in the activity is this calendar: <a href="https://github.com/prolificinteractive/material-calendarview" rel="noreferrer">https://github.com/prolificinteractive/material-calendarview</a></p>
  
  <p><strong>Question:</strong> How to load <code>setContentView()</code> on the background?</p>
  
  <p><strong>Update:</strong> I followed Hitesh Sahu's advice and now I only have one activity with one container that gets replaced for each fragment, I'm assuming the way to load the xml content in the background will be the same for a fragment and an activity, but if there is any difference please do mention.</p>