title: Caused by java.lang.NullPointerException
body: <p>I'm new to android programming and I was creating a simple app from a tutorial when I got an error on debug.
  In the tutorial the app contains a button that counts how many times it's pressed, and that project works, but I edited the project to create an app with two buttons, one button counts how many times it's pressed (with a simple if-else) and other reset the counting.
  This modified app doesn't work.</p>
  
  <p>These are code errors and code files:</p>
  
  <p>Errors:</p>
  
  <pre><code>11-25 21:47:32.888: E/AndroidRuntime(6865): FATAL EXCEPTION: main
  11-25 21:47:32.888: E/AndroidRuntime(6865): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.flavio.tictactoe/com.flavio.tictactoe.TicTacToe}: java.lang.NullPointerException
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1970)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at android.app.ActivityThread.access$600(ActivityThread.java:128)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at android.os.Handler.dispatchMessage(Handler.java:99)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at android.os.Looper.loop(Looper.java:137)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at android.app.ActivityThread.main(ActivityThread.java:4514)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at java.lang.reflect.Method.invokeNative(Native Method)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at java.lang.reflect.Method.invoke(Method.java:511)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at dalvik.system.NativeStart.main(Native Method)
  11-25 21:47:32.888: E/AndroidRuntime(6865): Caused by: java.lang.NullPointerException
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at com.flavio.tictactoe.TicTacToe.onCreate(TicTacToe.java:24)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at android.app.Activity.performCreate(Activity.java:4465)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934)
  11-25 21:47:32.888: E/AndroidRuntime(6865):     ... 11 more
  </code></pre>
  
  <p>TicTacToe.java(yes, I know it isn't a tic tac toe app :) ):</p>
  
  <pre><code>package com.flavio.tictactoe;
  
  import android.os.Bundle;
  import android.widget.Button;
  import android.app.Activity;
  import android.view.View;
  
  public class TicTacToe extends Activity 
  implements View.OnClickListener{
  
  Button button;
  int touchCount;
  String number;
  Button ResetButton;
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
  
  super.onCreate(savedInstanceState);
  button = new Button(this);
  button=((Button)this.findViewById(R.id.button_count));
  button.setText( "Touch me!" );
  button.setOnClickListener(this);
  ResetButton=new Button(this);
  ResetButton=((Button)this.findViewById(R.id.button_reset));
  ResetButton.setText("Reset");
  ResetButton.setOnClickListener(this);
  setContentView(R.id.button_count);
  setContentView(R.id.button_reset);
  
  }
  
  
  public void onClick(View v) {
      switch(v.getId()){
  
      case R.id.button_count:
          touchCount++;
          if(touchCount&gt;1){
              number=" times";
              }else{
                  number=" time";
                  }
  
          button.setText("Touched me " + touchCount + number);
      case R.id.button_reset:
          touchCount=0;
          if(touchCount&gt;1){
              number=" times";
              }else{
                  number=" time";
                  }
  
      }
      }
  }
  </code></pre>
  
  <p>activity_tic_tac_toe.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"
  tools:context=".TicTacToe" &gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:layout_centerVertical="true"
      android:text="@string/hello_world" /&gt;
  
  &lt;Button
      android:id="@+id/button_count"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"/&gt;
  
      &lt;Button
          android:id="@+id/button_reset"
          android:layout_height="wrap_content"
          android:layout_width="fill_parent"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>P.S. I have got a problem with android.jar file: every time I want to see a .class file, eclipse tells me 'Source not found'</p>