@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* SET THIS IN ADVANCE IN CASE ACTIVITY IS DESTROYED! * @Matt 17/March/2016 */ setResult(-1); Log.println(Log.WARN, "GTMovies", "LOGIN ACTIVITY ONCREATE!"); if (IOActions.userSignedIn()) { Log.i("GTMovies", "user already logged in"); finish(); return; } setContentView(R.layout.activity_login); rootView = findViewById(R.id.login_root); // start welcome screen startActivityForResult(new Intent(this, WelcomeActivity.class), 1); // load existing users try { accounts = IOActions.getAccounts(); } catch (Exception e) { Log.e("GTMovies", "Exception: " + Log.getStackTraceString(e)); } // remove up button ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setDisplayShowHomeEnabled(false); } // Set up the login form. mEmailView = (TextView) findViewById(R.id.email); mNameView = (EditText) findViewById(R.id.name); mPassConfirmView = (EditText) findViewById(R.id.passwordConfirm); mPasswordView = (EditText) findViewById(R.id.password); mPasswordView.setOnEditorActionListener( new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) { if (id == R.id.login || id == EditorInfo.IME_NULL) { attemptLogin(); return true; } return false; } }); // buttons Button mEmailSignInButton = (Button) findViewById(R.id.email_sign_in_button); mEmailSignInButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View view) { attemptLogin(); } }); Button mRegisterButton = (Button) findViewById(R.id.register_button); mRegisterButton.setOnClickListener( new OnClickListener() { @Override public void onClick(View view) { onRegisterPressed(); } }); }