title: Class Cast Exception in instantiateItem of a ViewPager
body: <p>I want to set some TextViews in fragments inside of a ViewPager. i'm setting my TextViews in onActivityCreated function of my fragments when it's instantiate pages . according to some posts returning <strong>POSITION_NONE</strong> in getItemPosition solve my problem but because of deleting all views everytime it's not an efficient way.so i've change it to <strong>instatiateItem(ViewGroup container, int position)</strong> but when i returning the view of my Fragments it throws : </p>
  
  <pre><code>ClassCastException : android.Widget.LinearLayout cannot be cast to android.support.v4.app.Fragment
  </code></pre>
  
  <p>here is my instantiateItem(ViewGroup container, int position) function, does anybody know how can i manage this exception? or how can i refresh a TextView in a Fragment inside of a ViewPager?
  Thanks in Advance</p>
  
  <pre><code>@Override
      public Object instantiateItem(ViewGroup container, int position) 
      {
          LayoutInflater inflater = (LayoutInflater) mContext
                  .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
          if (position == 3) {
              view = inflater.inflate(R.layout.projecttracking_detail_customerproject_fragment, null);
              ((ViewPager) container).addView(view, 0);
          }
          else if(position == 2) {
              view = inflater.inflate(R.layout.projecttracking_detail_projectinformation_fragment, null);
              ((ViewPager) container).addView(view, 0);
          }
  
  
          return view;
  
      }
  </code></pre>