title: I got java.lang.IllegalArgumentException: No view found for id when try to use viewpager
body: <p>I am using viewpager in my android project. In the fragment I need to open a pdf file. I used library to handle pdf file opening .without pdf opening methods(read() and open()) this is working fine. but when I call those two methods it gives me above exception</p>
  
  <p>This is my main class</p>
  
  <pre><code>    package com.android.pageviewers;    
      import java.util.ArrayList;
      import java.util.List;
      import android.content.Intent;
      import android.os.Bundle;
      import android.support.v4.app.Fragment;
      import android.support.v4.app.FragmentActivity;
      import android.support.v4.app.FragmentManager;
      import android.support.v4.app.FragmentPagerAdapter;
      import android.support.v4.view.ViewPager;
  
      public class PageViewActivity extends FragmentActivity implements Communicator{
      MyPageAdapter pageAdapter;
  
  
  
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)   {
     View contentView = inflater.inflate(R.layout.activity_page_view, container, false);
     List&lt;Fragment&gt; fragments = getFragments();   
     pageAdapter = new MyPageAdapter(getSupportFragmentManager(), fragments);        
     ViewPager pager = (ViewPager)contentView.findViewById(R.id.pager);
      pager.setAdapter(pageAdapter);
    return contentView;
  }
  
  
      private List&lt;Fragment&gt; getFragments(){
          List&lt;Fragment&gt; fList = new ArrayList&lt;Fragment&gt;();
  
          fList.add(MyFragment.newInstance("Fragment 1"));
          fList.add(MyFragment.newInstance("Fragment 2"));
          //fList.add(MyFragment3.newInstance("Fragment 3"));
  
          return fList;
      }
  
      private class MyPageAdapter extends FragmentPagerAdapter {
          private List&lt;Fragment&gt; fragments;
  
          public MyPageAdapter(FragmentManager fm, List&lt;Fragment&gt; fragments) {
              super(fm);
              this.fragments = fragments;
          }
          @Override
          public Fragment getItem(int position) {
              return this.fragments.get(position);
          }
  
          @Override
          public int getCount() {
              return this.fragments.size();
          }
      }
  
      @Override
      public void viewPdf() {
  
          //ShowPdf.read();
  
      }
      }
  
  
  This is my fragment
  
     package com.android.pageviewers;
  
  import java.io.File;
  import java.io.InputStream;
  
  import com.epapyrus.plugpdf.SimpleDocumentReader;
  import com.epapyrus.plugpdf.SimpleDocumentReaderListener;
  import com.epapyrus.plugpdf.SimpleReaderFactory;
  import com.epapyrus.plugpdf.core.viewer.DocumentState;
  
  import android.content.Intent;
  import android.content.res.AssetManager;
  import android.net.Uri;
  import android.os.Bundle;
  import android.os.Environment;
  import android.support.v4.app.Fragment;
  import android.util.Log;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.TextView;
  
  public class MyFragment extends Fragment {
      public static final String EXTRA_MESSAGE = "EXTRA_MESSAGE";
  
  
      // create a listener for receiving provide pdf loading results
              SimpleDocumentReaderListener m_listener = new
   SimpleDocumentReaderListener() {
  
                  @Override
                  public void onLoadFinish(DocumentState.OPEN state) {
                  }
              };
  
  
      public static final MyFragment newInstance(String message)
      {
          MyFragment f = new MyFragment();
          Bundle bdl = new Bundle(1);
          bdl.putString(EXTRA_MESSAGE, message);
          f.setArguments(bdl);
  
          return f;
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, 
          Bundle savedInstanceState) {
          String message = getArguments().getString(EXTRA_MESSAGE);
          View v = inflater.inflate(R.layout.myfragment_layout, container, false);
          TextView messageTextView = (TextView)v.findViewById(R.id.textView);
          messageTextView.setText(message);
          read();
          return v;
      }
  
  
      public void read(){
  
          String fileName = new String("1.pdf");      
          AssetManager am = getResources().getAssets();
  
          try {
              InputStream is = am.open(fileName);
              //SimpleDocumentReader.openFile();
  
              int size = is.available();
              if (size &gt; 0) {
                  byte[] data = new byte[size];
                  is.read(data);
                  open(data);
              }
  
              is.close();
  
          } catch (Exception ex) {
              ex.printStackTrace();
          }
  
  
      }
  
      public void open(byte[] words) {
          try {           
  
          // pdfviewer create.
          SimpleDocumentReader viewer =    
      SimpleReaderFactory.createSimpleViewer(getActivity(), m_listener); 
          // pdf data load.
          viewer.openData(words, words.length, "");
  
          } catch (Exception ex) {
              Log.e("KS", "error ", ex);
              ex.printStackTrace();
          } 
      }
  
  
       }
  </code></pre>
  
  <p>when i run this project it gives me the mentioned error.I have already added the id for pageviewer.</p>
  
  <pre><code>10-01 08:56:45.273: E/AndroidRuntime(2824): java.lang.IllegalArgumentException: No view found for id 0x7f0a003c (com.android.pageviewers:id/pager) for fragment MyFragment{41468878 #1 id=0x7f0a003c android:switcher:2131361852:1}
  </code></pre>
  
  <p>Here is my layout file:</p>
  
  <pre><code>&lt;RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent" &gt;
  
    &lt;android.support.v4.view.ViewPager
      android:id="@+id/pager"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>I removed onCreate method from my main class and the the onCreateView.Now there is no any exception.but it doesn't show me the pdf  file,just blan page,i am unable to swipe too.</p>