title: NullPointerException in onCreate of Activity
body: <p>I have a splash page that opens up when my app is open, and then it is replaced by a <code>LoginActivity</code> that gives the option to the user of logging into Twitter with the app.  This is the onCreate method of <code>LoginActivity</code>:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_login);
      // Show the Up button in the action bar.
      setupActionBar();
      Log.i("here", "login has started");
      Button loginTwitter = (Button) findViewById(R.id.twitterLoginButton);
      Button noLogin = (Button) findViewById(R.id.noLoginButton);
      loginTwitter.setOnClickListener(new View.OnClickListener() {
          /**
           * Login via Twitter
           */
          @SuppressLint("NewApi")
          public void onClick(View v) {
              Intent i = new Intent(getApplicationContext(), PrepareRequestTokenActivity.class);
              startActivity(i);
          }
      });
  
      noLogin.setOnClickListener(new View.OnClickListener() {
          /**
           * Proceed to use app without login
           */
          @SuppressLint("NewApi")
          public void onClick(View v) {
              Intent i = new Intent(getApplicationContext(), MainActivity.class);
              startActivity(i);
          }
      });
  
  
  }
  </code></pre>
  
  <p>When the app is started up, the splash displays fine, but the LoginActivity brings about a NullPointerException pointing specifically at the line 29, which is: <code>loginTwitter.setOnClickListener(new View.OnClickListener() {</code></p>
  
  <p>I cannot even begin to understand why this is happening.  Does anyone have any idea?  Logcat below:</p>
  
  <pre><code>06-25 00:06:21.000: E/AndroidRuntime(4809): FATAL EXCEPTION: main
  06-25 00:06:21.000: E/AndroidRuntime(4809): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tforan.blobtag4/com.tforan.blobtag4.LoginActivity}: java.lang.NullPointerException
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1852)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1873)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at android.app.ActivityThread.access$1500(ActivityThread.java:135)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1054)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at android.os.Handler.dispatchMessage(Handler.java:99)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at android.os.Looper.loop(Looper.java:150)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at android.app.ActivityThread.main(ActivityThread.java:4358)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at java.lang.reflect.Method.invokeNative(Native Method)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at java.lang.reflect.Method.invoke(Method.java:507)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at dalvik.system.NativeStart.main(Native Method)
  06-25 00:06:21.000: E/AndroidRuntime(4809): Caused by: java.lang.NullPointerException
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at com.tforan.blobtag4.LoginActivity.onCreate(LoginActivity.java:29)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1816)
  06-25 00:06:21.000: E/AndroidRuntime(4809):     ... 11 more
  </code></pre>
  
  <p>I should add that this was working fine as is until updating my ADT, Play services, etc.  Thank you for the help!</p>
  
  <p>activity_login.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"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  android:background="#D0E4F7"
  tools:context=".LoginActivity" &gt;
  
  &lt;ImageView
      android:id="@+id/loginLogo"
      android:contentDescription="@string/logo"
      android:layout_centerHorizontal="true"
      android:layout_width="200dp"
      android:layout_height="200dp"
      android:layout_alignParentTop="true"
      android:src="@drawable/logo" /&gt;
  
  &lt;Button
      android:id="@+id/twitterLoginButton"
      style="@style/buttonText"
      android:layout_below="@+id/loginLogo"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_centerHorizontal="true"
      android:background="@drawable/signinwithtwitter"
      android:textColor="#000000" /&gt;
  
  &lt;Button
      android:id="@+id/noLoginButton"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@+id/twitterLoginButton"
      android:layout_centerHorizontal="true"
      android:layout_marginTop="25dp"
      android:paddingTop="5dp"
      android:textSize="12dp"
      android:text="@string/declineLogin" /&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>