title: Getting a fatal exception: main error
body: <p>I've been designing the login and signup screen of my app. And after changing the actionbar settings in my main activity I can't seem to login into the app. The login and signup screens load up perfectly. But then It says "Unfortunately, ____ has stopped" This is the error that I get, I've also included my LoginActivity.java as it says that's where the error is. But I don't know which other file to reference, so if you need another file let me know and I'll update it. THANKS!</p>
  
  <pre><code> 1493-1493/com.example.aalok.chirp E/AndroidRuntime﹕ FATAL EXCEPTION: main
  Process: com.example.aalok.chirp, PID: 1493
  java.lang.NullPointerException
          at com.example.aalok.chirp.LoginActivity$2.onClick(LoginActivity.java:58)
          at android.view.View.performClick(View.java:4438)
          at android.view.View$PerformClick.run(View.java:18422)
          at android.os.Handler.handleCallback(Handler.java:733)
          at android.os.Handler.dispatchMessage(Handler.java:95)
          at android.os.Looper.loop(Looper.java:136)
          at android.app.ActivityThread.main(ActivityThread.java:5017)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:515)
          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
          at dalvik.system.NativeStart.main(Native Method)
  
  
      package com.example.aalok.chirp;
  
  import android.app.ActionBar;
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.Window;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.TextView;
  
  import com.parse.LogInCallback;
  import com.parse.Parse;
  import com.parse.ParseException;
  import com.parse.ParseUser;
  import com.parse.SignUpCallback;
  
  
  public class LoginActivity extends Activity {
  
      protected EditText mUsername;
      protected EditText mPassword;
      protected Button mLoginButton;
      protected TextView mSignUpTextView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
          setContentView(R.layout.activity_login);
  
          ActionBar actionBar = getActionBar();
          actionBar.hide();
  
          //Set up SignUp text
          mSignUpTextView = (TextView) findViewById(R.id.signUpText);
          mSignUpTextView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent intent = new Intent(LoginActivity.this, SignUpActivity.class);
                  startActivity(intent);
              }
          });
  
          mUsername = (EditText) findViewById(R.id.usernameField);
          mPassword = (EditText) findViewById(R.id.passwordField);
  
          //Set up Login button
          mLoginButton = (Button) findViewById(R.id.loginButton);
          mLoginButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  String username = mUsername.getText().toString();
                  String password = mPassword.getText().toString();
  
                  username = username.trim();
                  password = password.trim();
  
                  if (username.isEmpty() || password.isEmpty()) {
                      AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
                      builder.setMessage(R.string.login_error_message)
                              .setTitle(R.string.login_error_title)
                              .setPositiveButton(android.R.string.ok, null);
                      AlertDialog dialog = builder.create();
                      dialog.show();
                  } else {
                      //LOGIN
                      setProgressBarIndeterminateVisibility(true);
  
                      ParseUser.logInInBackground(username, password, new LogInCallback() {
                          @Override
                          public void done(ParseUser user, ParseException e) {
                              setProgressBarIndeterminateVisibility(false);
                              if (e == null) {
                                  //SUCCESS!
                                  Intent intent = new Intent(LoginActivity.this, MainActivity.class);
                                  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                                  intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                                  startActivity(intent);
                              } else {
                                  AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
                                  builder.setMessage(e.getMessage())
                                          .setTitle(R.string.login_error_title)
                                          .setPositiveButton(android.R.string.ok, null);
                                  AlertDialog dialog = builder.create();
                                  dialog.show();
                              }
                          }
                      });
                  }
  
              }
          });
      }
  }
  </code></pre>