title: Android Studio:Error:cannot find symbol variable activity_main
body: <p>When i try to run <a href="https://i.stack.imgur.com/4S8Iz.png" rel="nofollow noreferrer">this</a> program i get <a href="https://i.stack.imgur.com/PYxFQ.png" rel="nofollow noreferrer">this</a> error(cannot find symbol variable activity_main)
  <a href="https://i.stack.imgur.com/LQfkr.png" rel="nofollow noreferrer">This</a> is my AndroidManifest.xml
  <a href="https://i.stack.imgur.com/axqne.png" rel="nofollow noreferrer">This</a> is my activity_main.xml</p>
  
  <p>Code:MainActivity.java:</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
      Button button;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          RelativeLayout bgElement = (RelativeLayout) findViewById(R.id.activity_main);
          bgElement.setBackgroundColor(Color.WHITE);
          ButtonListCheck();
      }
  
  
      public void ButtonListCheck() {
          button = (Button) findViewById(R.id.button);
          button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  RelativeLayout bgElement;
                  bgElement = (RelativeLayout)
                          findViewById(R.id.activity_main);
                  int color = ((ColorDrawable)
                          bgElement.getBackground()).getColor();
                  if (color == Color.RED) {
                      bgElement.setBackgroundColor(Color.BLUE);
                  } else {
                      bgElement.setBackgroundColor(Color.RED);
                  }
              }
          });
      }
  }
  </code></pre>
  
  <p>Code activity_main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context=".MainActivity"&gt;
  
      &lt;Button
          android:id="@+id/button"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/change" /&gt;
  &lt;/android.support.constraint.ConstraintLayout&gt;
  </code></pre>
  
  <p>Code AndroidManifest.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.razvan.fckingbutton"&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".MainActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>I already tried Invalidate Cache/Restart
    Please help me!</p>