title: Cannot resolve method findViewByID(int) fragment java
body: <p>Errors on:  updated</p>
  
  <p>Tried to use <code>GetView.findViewById</code> error cannot resolve method <code>GetView</code>
  tried to use just <code>findViewById</code> error cannot resolve <code>findViewById(int)</code></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>package com.example.user.myapplication.Tabs;
  
  import android.animation.Animator;
  import android.animation.ValueAnimator;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.ViewTreeObserver;
  import android.widget.LinearLayout;
  
  import com.example.user.myapplication.R;
  
  public class Hotel extends Fragment {
  
      LinearLayout mLinearLayout;
      LinearLayout mLinearLayoutHeader;
      ValueAnimator mAnimator;
  
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          View v =inflater.inflate(R.layout.hotel_frag,container,false);
          return v;
  
         mLinearLayout = (LinearLayout) v.findViewById(R.id.expandable);
          //mLinearLayout.setVisibility(View.GONE);
          mLinearLayoutHeader = (LinearLayout) v.findViewById(R.id.header);
  
          //Add onPreDrawListener
          mLinearLayout.getViewTreeObserver().addOnPreDrawListener(
                  new ViewTreeObserver.OnPreDrawListener() {
  
                      @Override
                      public boolean onPreDraw() {
                          mLinearLayout.getViewTreeObserver().removeOnPreDrawListener(this);
                          mLinearLayout.setVisibility(View.GONE);
  
                          final int widthSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
                          final int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
                          mLinearLayout.measure(widthSpec, heightSpec);
  
                          mAnimator = slideAnimator(0, mLinearLayout.getMeasuredHeight());
                          return true;
                      }
                  });
  
  
          mLinearLayoutHeader.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  if (mLinearLayout.getVisibility()==View.GONE){
                      expand();
                  }else{
                      collapse();
                  }
              }
          });
  
          return v;
      }
  
  
      private void expand() {
          //set Visible
          mLinearLayout.setVisibility(View.VISIBLE);
  
    /* Remove and used in preDrawListener
    final int widthSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    final int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
    mLinearLayout.measure(widthSpec, heightSpec);
  
    mAnimator = slideAnimator(0, mLinearLayout.getMeasuredHeight());
    */
  
          mAnimator.start();
      }
  
      private void collapse() {
          int finalHeight = mLinearLayout.getHeight();
  
          ValueAnimator mAnimator = slideAnimator(finalHeight, 0);
  
          mAnimator.addListener(new Animator.AnimatorListener() {
              @Override
              public void onAnimationEnd(Animator animator) {
                  //Height=0, but it set visibility to GONE
                  mLinearLayout.setVisibility(View.GONE);
              }
  
              @Override
              public void onAnimationStart(Animator animator) {
              }
  
              @Override
              public void onAnimationCancel(Animator animator) {
              }
  
              @Override
              public void onAnimationRepeat(Animator animator) {
              }
          });
          mAnimator.start();
  
      }
  
  
      private ValueAnimator slideAnimator(int start, int end) {
  
          ValueAnimator animator = ValueAnimator.ofInt(start, end);
  
  
          animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
              @Override
              public void onAnimationUpdate(ValueAnimator valueAnimator) {
                  //Update Height
                  int value = (Integer) valueAnimator.getAnimatedValue();
  
                  ViewGroup.LayoutParams layoutParams = mLinearLayout.getLayoutParams();
                  layoutParams.height = value;
                  mLinearLayout.setLayoutParams(layoutParams);
              }
          });
          return animator;
      }
  }</code></pre>
  </div>
  </div>
  </p>