title: Android: What is the proper way to override onCreateView?
body: <p>My current issue is that I am trying to trigger an Animator to transition between two Activities. My goal is to create a circular reveal transition from one Activity to another.</p>
  
  <p>I am starting to get this error: "Cannot start this animator on a detached view!"</p>
  
  <p>I was looking around Stack Overflow and found this: <a href="https://stackoverflow.com/questions/26819429/cannot-start-this-animator-on-a-detached-view-reveal-effect">Cannot start this animator on a detached view! reveal effect</a></p>
  
  <p>One explanation seems to be that the view for the second Activity has not yet been inflated which is why the Animator is not able to start. </p>
  
  <p>The person in the thread used this as the solution:</p>
  
  <pre><code>@Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
  {
      // Inflate the layout for this fragment
      final View view = inflater.inflate(R.layout.fragment_map_list, container, false);
      if(Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.LOLLIPOP) {
          view.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
              @TargetApi(Build.VERSION_CODES.LOLLIPOP)
              @Override
              public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
                  v.removeOnLayoutChangeListener(this);
                  toggleInformationView(view);
              }
          });
      }
      return view;
  }
  </code></pre>
  
  <p>However, I'm a little bit confused about what's happening here. It seems that he is also inflating the layout for the Activity. If that's the case, should I not call: </p>
  
  <pre><code>setContentView(R.layout.activity_bnew_account);
  </code></pre>
  
  <p>in the onCreate method of the Activity? Should I be using the layout inflater in the overridden onCreateView to inflate the activity layout? Thanks for any advice on how to solve this problem.</p>