title: Why FragmentTransaction can't find the Layout area by it's ID? Showing error
body: <p>I am practicing Fragment. The application has three buttons- <em>Start, Button 1, Button 2.</em> <em>Start</em> button should start the fragment, <em>Button 1</em> and <em>Button 2</em> shows the corresponding text.
  The problem is in my MianActivity.java file. 
   line 34 shows an error:</p>
  
  <p><img src="https://i.stack.imgur.com/PgT9W.png" alt="enter image description here">
  My code:
  MainActivity.java:</p>
  
  <pre><code> package com.mycompany.fragment;
  
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentTransaction;
  import android.support.v4.app.FragmentActivity;
  //import android.support.v4.app.*;
  import android.os.Bundle;
  import android.view.View;
  
  public class MainActivity extends FragmentActivity {
    @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
   android.support.v4.app.FragmentManager fragmentManager = getSupportFragmentManager();
     android.support.v4.app.FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
       StartFrag startFrag = new StartFrag();
    fragmentTransaction.add(R.id.textViewArea_1,startFrag);
          fragmentTransaction.commit();
     }
  public void clickButton(View view) {
  
           Fragment newFragment;
      if (view == findViewById(R.id.button)) {
          newFragment=new Fragment();
   } else if (view == findViewById(R.id.button1)) {
          newFragment= new Frag1();//shows error: "Incompitable types Required: android.support.v4.app.Fragment, Found: com.mycompany.fragment.Frag1"
      } else if (view == findViewById(R.id.button2)) {
          newFragment= new Frag2();//shows error: "Incompitable types Required: android.support.v4.app.Fragment Found: com.mycompany.fragment.Frag2"
      } else {
   newFragment=new Fragment();
      }
     android.support.v4.app.FragmentTransaction transaction=getSupportFragmentManager().beginTransaction();
          transaction.replace(R.id.textViewArea_1,newFragment);//Line 34
          transaction.addToBackStack(null);
          transaction.commit();
   }
  
  }
  </code></pre>
  
  <p>activity_main.xml:</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" android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
      android:background="#468499"&gt;
  
      &lt;Button
          android:layout_width="120dp"
          android:layout_height="wrap_content"
          android:text="Start"
          android:id="@+id/button"
          android:background="#6d0e0e"
          android:layout_alignParentTop="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginTop="32dp"
          android:textColor="#147907"
          android:textStyle="bold"
          android:onClick="clickButton"/&gt;
  
      &lt;Button
          android:layout_width="120dp"
          android:layout_height="wrap_content"
          android:text="Fragment 1"
          android:id="@+id/button1"
          android:layout_alignTop="@+id/button"
          android:layout_centerHorizontal="true"
          android:background="#6d0e0e"
          android:textColor="#147907"
          android:textStyle="bold"
          android:onClick="clickButton"/&gt;
  
      &lt;Button
          android:layout_width="120dp"
          android:layout_height="wrap_content"
          android:text="Fragment 2"
          android:id="@+id/button2"
          android:layout_alignTop="@+id/button1"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:background="#6d0e0e"
          android:textColor="#147907"
          android:textStyle="bold"
          android:onClick="clickButton"/&gt;
  
  
      &lt;LinearLayout
          android:orientation="horizontal"
          android:layout_width="match_parent"
          android:layout_height="200dp"
          android:layout_alignParentBottom="true"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:id="@+id/textViewArea_1"
          android:background="#fbf896"&gt;&lt;/LinearLayout&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>StartFrag.java:</p>
  
  <pre><code>    package com.mycompany.fragment;
  
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.*;
  
  public class StartFrag extends Fragment{
  
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          return inflater.inflate(R.layout.activity_main,container,false);
      }
  }
  </code></pre>
  
  <p>start_frag.xml:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="match_parent"
      android:background="#468499"&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Frag1.java:</p>
  
  <pre><code>    package com.mycompany.fragment;
  
  import android.app.Fragment;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  public class Frag1 extends Fragment {
  
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          return inflater.inflate(R.layout.frag_1,container,false);
      }
  }
  </code></pre>
  
  <p>frag_1.xml:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="match_parent"
      android:background="#468499"&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="90dp"
          android:text="Fragment 1"
          android:id="@+id/textView1"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          android:textColor="#6d0e0e"
          android:textSize="40dp" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Frag2.java:</p>
  
  <pre><code>    package com.mycompany.fragment;
  
  import android.app.Fragment;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  public class Frag2 extends Fragment {
  
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          return inflater.inflate(R.layout.frag_2,container,false);
      }
  }
  </code></pre>
  
  <p>frag_2.xml:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent" android:layout_height="match_parent"
      android:background="#468499"&gt;
  
      &lt;TextView
          android:layout_width="match_parent"
          android:layout_height="90dp"
          android:text="Fragment 2"
          android:id="@+id/textView2"
          android:layout_alignParentTop="true"
          android:layout_centerHorizontal="true"
          android:textColor="#6d0e0e"
          android:textSize="40dp" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The error in Log:</p>
  
  <p><img src="https://i.stack.imgur.com/GpjK6.jpg" alt="enter image description here"></p>