title: can't find this NullPointerException
body: <p>I keep getting a <code>Unable to instantiate activity ComponentInfo... Caused by a NullPointerException at findViewById</code> and i can't find out why it is throwing it. i have my elements id's set correctly in my <code>main.xml</code> and i have tried commenting out each line around where it is throwing to see which line is faulty but to get it to run w/o any force closes i have to comment out all the functionality of the program. here is my activity:</p>
  
  <pre><code>package fsg.dev.test.checkboxtest;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.CheckBox;
  import android.widget.CompoundButton;
  import android.widget.CompoundButton.OnCheckedChangeListener;
  import android.widget.SeekBar;
  
  public class checkBoxTest extends Activity {
      private CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox);
      //private SeekBar seekbar = (SeekBar) findViewById(R.id.seekbar);
      private View view = (View) findViewById(R.id.background);
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
  
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      checkbox.setOnCheckedChangeListener(new OnCheckedChangeListener(){
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked){
              changeColor();
          }
      });
  }
  
  private void changeColor(){
      if(checkbox.isChecked()){
          view.setBackgroundColor(R.color.Blue);
          //view.setAlpha(.25);
      }
      else if(!checkbox.isChecked()){
          view.setBackgroundColor(R.color.White);
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>and here is my manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="fsg.dev.test.checkboxtest"
    android:versionCode="1"
    android:versionName="1.0"&gt;
  &lt;uses-sdk android:minSdkVersion="10" /&gt;
  
  &lt;application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true"&gt;
      &lt;activity android:name=".checkBoxTest"
                android:label="@string/app_name"&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>and finally my main.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"&gt;
  
  &lt;CheckBox 
      android:text="Background Color" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:checked="false"
      android:id="@+id/checkbox"&gt;
  &lt;/CheckBox&gt;
  &lt;SeekBar 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent"
      android:id="@+id/seekbar" 
      android:layout_margin="10dip" &gt;
  &lt;/SeekBar&gt;
  &lt;View
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:background="@color/White"
      android:id="@+id/background"&gt;
  &lt;/View&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>if anyone could help me narrow this down that would be excellent.</p>