title: Android Studio Error: cannot find symbol variable fragment_main
body: <p>I'm developing my second Android Appliction, a simple calculator
  with the following operation</p>
  
  <p>Addition, Subtraction, Multiplication, Division, Modulus</p>
  
  <p>code:</p>
  
  <p>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"&gt;
  
   &lt;TableLayout
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       android:layout_gravity="center"&gt;
  
       &lt;TableRow
           android:layout_width="fill_parent"
           android:layout_height="fill_parent"&gt;
  
           &lt;TextView
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:textAppearance="?android:textAppearanceMedium"
               android:text="Number 1"
               android:id="@+id/textView"
               android:layout_column="1"/&gt;
           &lt;EditText
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:inputType="number"
               android:ems="10"
               android:id="@+id/num1"
               android:layout_column="3"
               /&gt;
  
  
       &lt;/TableRow&gt;
  
       &lt;TableRow
           android:layout_width="match_parent"
           android:layout_height="match_parent"&gt;
  
           &lt;TextView
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:textAppearance="?android:attr/textAppearanceMedium"
               android:text="Number 2"
               android:id="@+id/textView2"
               android:layout_column="1" /&gt;
  
           &lt;EditText
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:inputType="number"
               android:ems="10"
               android:id="@+id/num2"
               android:layout_column="3" /&gt;
       &lt;/TableRow&gt;
  
       &lt;TableRow
           android:layout_width="match_parent"
           android:layout_height="match_parent"&gt;
  
           &lt;Button
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="+ADD"
               android:id="@+id/btAdd"
               android:layout_column="3" /&gt;
       &lt;/TableRow&gt;
  
       &lt;TableRow
           android:layout_width="match_parent"
           android:layout_height="match_parent"&gt;
  
           &lt;Button
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="-Subtract"
               android:id="@+id/btSub"
               android:layout_column="3" /&gt;
       &lt;/TableRow&gt;
  
       &lt;TableRow
           android:layout_width="match_parent"
           android:layout_height="match_parent"&gt;
  
           &lt;Button
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="xMultiply"
               android:id="@+id/btMul"
               android:layout_column="3" /&gt;
       &lt;/TableRow&gt;
  
       &lt;TableRow
           android:layout_width="match_parent"
           android:layout_height="match_parent"&gt;
  
           &lt;Button
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="/ Divide"
               android:id="@+id/btDiv"
               android:layout_column="3" /&gt;
       &lt;/TableRow&gt;
  
       &lt;TableRow
           android:layout_width="match_parent"
           android:layout_height="match_parent"&gt;
  
           &lt;Button
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="% Mod"
               android:id="@+id/btMod"
               android:layout_column="3" /&gt;
       &lt;/TableRow&gt;
  
       &lt;TableRow
           android:layout_width="match_parent"
           android:layout_height="match_parent"&gt;&lt;/TableRow&gt;
  
       &lt;TableRow
           android:layout_width="match_parent"
           android:layout_height="match_parent"&gt;
  
           &lt;TextView
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:textAppearance="?android:attr/textAppearanceMedium"
               android:text="Result:"
               android:id="@+id/result"
               android:layout_column="1" /&gt;
       &lt;/TableRow&gt;
   &lt;/TableLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The java code is:</p>
  
  <p>mainActivity.java</p>
  
  <pre><code>    package in.infoexpo.sreerajm.secapp;
  
      import android.app.Fragment;
      import android.support.v7.app.AppCompatActivity;
      import android.os.Bundle;
      import android.text.Layout;
      import android.view.LayoutInflater;
      import android.view.Menu;
      import android.view.MenuItem;
      import android.view.View;
      import android.view.ViewGroup;
      import android.widget.Button;
      import android.widget.EditText;
      import android.widget.TextView;
  
      public class MainActivity extends AppCompatActivity {
  
      public static class PlaceholderFragment extends Fragment {
          public PlaceholderFragment(){
  
          }
          @Override
  
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
              final View rootView = inflater.inflate(R.layout.fragment_main, container, false);
  
  
              Button btAdd = (Button) rootView.findViewById(R.id.btAdd);
              Button btSub = (Button) rootView.findViewById(R.id.btSub);
              Button btMul = (Button) rootView.findViewById(R.id.btMul);
              Button btDiv = (Button) rootView.findViewById(R.id.btDiv);
              Button btMod = (Button) rootView.findViewById(R.id.btMod);
  
              btAdd.setOnClickListener(new View.OnClickListener() {
                  public void onClick(View view) {
  
                      int n1, n2;
                      EditText num1 = (EditText) rootView.findViewById(R.id.num1);
                      EditText num2 = (EditText) rootView.findViewById(R.id.num2);
                      n1 = Integer.parseInt(num1.getText().toString());
                      n2 = Integer.parseInt(num2.getText().toString());
  
                      TextView result = (TextView) rootView.findViewById(R.id.result);
                      result.setText(n1 + n2);
                  }
  
              });
              btSub.setOnClickListener(new View.OnClickListener() {
                  public void onClick(View view) {
  
                      int n1, n2;
                      EditText num1 = (EditText) rootView.findViewById(R.id.num1);
                      EditText num2 = (EditText) rootView.findViewById(R.id.num2);
                      n1 = Integer.parseInt(num1.getText().toString());
                      n2 = Integer.parseInt(num2.getText().toString());
  
                      TextView result = (TextView) rootView.findViewById(R.id.result);
                      result.setText(n1 - n2);
                  }
  
              });
              btMul.setOnClickListener(new View.OnClickListener() {
                  public void onClick(View view) {
  
                      int n1, n2;
                      EditText num1 = (EditText) rootView.findViewById(R.id.num1);
                      EditText num2 = (EditText) rootView.findViewById(R.id.num2);
                      n1 = Integer.parseInt(num1.getText().toString());
                      n2 = Integer.parseInt(num2.getText().toString());
  
                      TextView result = (TextView) rootView.findViewById(R.id.result);
                      result.setText(n1 * n2);
                  }
  
              });
              btDiv.setOnClickListener(new View.OnClickListener() {
                  public void onClick(View view) {
  
                      int n1, n2;
                      EditText num1 = (EditText) rootView.findViewById(R.id.num1);
                      EditText num2 = (EditText) rootView.findViewById(R.id.num2);
                      n1 = Integer.parseInt(num1.getText().toStenter code herering());
                      n2 = Integer.parseInt(num2.getText().toString());
  
                      TextView result = (TextView) rootView.findViewById(R.id.result);
                      result.setText(n1 / n2);
                  }
  
              });
              btMod.setOnClickListener(new View.OnClickListener() {
                  public void onClick(View view) {
  
                      int n1, n2;
                      EditText num1 = (EditText) rootView.findViewById(R.id.num1);
                      EditText num2 = (EditText) rootView.findViewById(R.id.num2);
                      n1 = Integer.parseInt(num1.getText().toString());
                      n2 = Integer.parseInt(num2.getText().toString());
  
                      TextView result = (TextView) rootView.findViewById(R.id.result);
                      result.setText(n1 % n2);
                  }
  
              });
  
              return rootView;
  
  
          }
      }
  }
  </code></pre>
  
  <p>I tried many changes but one error can't be removed<br>
  Error: cannot find symbol variable fragment_main
  Plz help me to fix the error.</p>