title: Error in my Java code referring to my XML button
body: <p>When i try to link my Java to my XML, the computer doesn't seem to pick up my XML id of my buttons here is the java code:</p>
  
  <pre><code>package com.android.simple;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class MainActivity extends Activity {
  
  int counter;
  Button add;
  Button sub;
  TextView display;
  
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      counter = 0;
      add = (Button) findViewById(R.layout.bAdd);
  }
  }
  </code></pre>
  
  <p>XML code, as you can see, the button's id is saved as bAdd and so it is  called in the java code as well: </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"
      tools:context="${packageName}.${activityClass}" &gt;
  
       &lt;Button
           android:layout_width="200dp"
           android:layout_height="50dp"
           android:layout_below="@+id/tvDisplay"
           android:layout_centerHorizontal="true"
           android:layout_marginTop="149dp"
           android:text="Subtract one" 
           android:id="@+id/bSub"
           /&gt;
  
       &lt;Button
           android:layout_width="200dp"
           android:layout_height="50dp"
           android:layout_alignBottom="@+id/bSub"
           android:layout_alignLeft="@+id/bSub"
           android:layout_marginBottom="67dp"
           android:text="Add one" 
           android:id="@+id/bAdd"
           /&gt;
  
       &lt;TextView
           android:layout_width="100dp"
           android:layout_height="20dp"
           android:layout_alignParentTop="true"
           android:layout_centerHorizontal="true"
           android:layout_marginTop="36dp"
           android:layout_weight="0.00"
           android:text="Your total is 0 " 
           android:id="@+id/tvDisplay"
           /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>