title: No view found for id 0x7f090005
body: <p>I'm starting to build a simple Android app so when I press my video button it calls a fragment which contains the video player, but I'm always getting: No view found for id 0x7f090005...</p>
  
  <p>I wonder if you give me a hand by figuring out what is wrong in the code that I'm writing.</p>
  
  <p>Here is my MainActivity.java file:</p>
  
  <pre>
  public class MainActivity extends Activity {
  
      private Button mVideoButton;
      Fragment fragment;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main_activity); 
  
          mVideoButton = (Button)findViewById(R.id.videoButton);
  
          // Video Button
          mVideoButton.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
  
                  FragmentManager fm = getFragmentManager();
                  FragmentTransaction ft = fm.beginTransaction();
                  FragmentVideo sf = new FragmentVideo();
  
                  ft.add(R.id.fragmentVideo, sf);
                  ft.commit();
              }
          });
      }
  }
  </pre>
  
  <p>Then I have my main_activity.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/activityStart" &gt;
  
      &lt;ImageView 
          android:src="@drawable/armstrong_on_moon"
          android:contentDescription="@string/description"
          android:layout_width="match_parent"
          android:layout_height="match_parent" 
          android:scaleType="centerInside"
          android:layout_weight="1" /&gt;
  
      &lt;TableRow 
          android:gravity="center|bottom"
          android:layout_weight="0"&gt;
  
          &lt;Button 
              android:id="@+id/videoButton"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="@string/video" /&gt;
  
      &lt;/TableRow&gt;
  </code></pre>
  
  <p>Next, my FragmentVideo.java class:</p>
  
  <pre><code>public class FragmentVideo extends Fragment{
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState ){
          View v = inflater.inflate(R.layout.fragment_video, parent, false);
  
          return v;
      }   
  }
  </code></pre>
  
  <p>And at last, the fragment_video.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:id="@+id/fragmentVideo" &gt;
  
          &lt;VideoView
              android:id="@+id/video"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:layout_gravity="center" /&gt;
  
          &lt;ProgressBar
              android:id="@+id/prog"
              android:layout_width="70dp"
              android:layout_height="70dp"
              android:layout_gravity="center" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Please let me know if I'm doing something wrong or if I'm missing something as I can see where the issue lays.</p>
  
  <p>Thanks very much for any help in advance.</p>
  
  <p>EGMWEB</p>