title: Id is not resolved or is not a field
body: <p>I am developing my <code>first program</code> using <code>Android</code>. It adds or subtracts to a total depending on which button the user clicks. I have made its <code>xml</code> and now I was creating its <code>java</code> but I getting some errors(Its not fully developed yet). I would be helpful if anyone can guide me. </p>
  
  <h2>main.xml</h2>
  
  <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="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Your Total is 0" 
          android:gravity="center"    
  
          /&gt;
  
    &lt;Button
          android:id="@+id/button1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="+1"
          android:layout_gravity="center" 
          android:text="Button" /&gt;  
  
  
      &lt;Button
          android:id="@+id/button2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="-1" 
          android:layout_gravity="center" 
          android:text="Button" /&gt;
  
  
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <h2>Java Source File</h2>
  
  <pre><code>package com.fahad.project;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.TextView;
  
  public class AndroidProject1Activity extends Activity {
      /** Called when the activity is first created. */
      int numberCount;
      Button add, sub;
      TextView display;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          numberCount =0;
          add=(Button)findViewById(R.id.bAdd);&lt;!--error--&gt;
          sub=(Button)findViewById(R.id.bSub);&lt;!--error--&gt;
          display=(TextView)findViewById(R.id.tvDisplay);&lt;!--error--&gt;
  
          add.setOnClickListener(new View.OnClickListener() {
  
              public void onClick(View v) {
                  // TODO Auto-generated method stub
  
              }
          });
  
          sub.setOnClickListener(new View.OnClickListener() {
  
              public void onClick(View v) {
                  // TODO Auto-generated method stub
  
              }
          });
  
  
      }
  }
  </code></pre>
  
  <h2>Error</h2>
  
  <pre><code>Id is not resolved or is not a field
  </code></pre>
  
  <p>Please help me out with this error. Thanks.</p>
  
  <h2>EDIT</h2>
  
  <p>Pasting its .R file,</p>
  
  <pre><code>/* AUTO-GENERATED FILE.  DO NOT MODIFY.
   *
   * This class was automatically generated by the
   * aapt tool from the resource data it found.  It
   * should not be modified by hand.
   */
  
  package com.fahad.project;
  
  public final class R {
      public static final class attr {
      }
      public static final class drawable {
          public static final int ic_launcher=0x7f020000;
      }
      public static final class layout {
          public static final int main=0x7f030000;
      }
      public static final class string {
          public static final int app_name=0x7f040001;
          public static final int hello=0x7f040000;
      }
  }
  </code></pre>