@Override public void onClick(View v) { switch (v.getId()) { case R.id.bLogout: userLocalStore.clearUserData(); userLocalStore.setUserLoggedIn(false); startActivity(new Intent(this, Login.class)); break; } }
private void logUserIn(User returnedUser) { userLocalStore.storeUserData(returnedUser); checkBox = (CheckBox) findViewById(R.id.checkBox); boolean checked = checkBox.isChecked(); if (checked) { userLocalStore.setUserLoggedIn(true); Log.d("tag1", "checked"); } // should go to the profile page but going ot the register page temporarily startActivity(new Intent(this, DonationHistory.class)); finish(); }
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return super.onOptionsItemSelected(item); } else if (id == R.id.action_logout) { AccessToken usedFacebook = AccessToken.getCurrentAccessToken(); if (usedFacebook != null) { facebookLogin.logOut(); } else { userLocalStore.clearUserData(); userLocalStore.setUserLoggedIn(false); } Intent loginIntent = new Intent(this, LoginActivity.class); startActivity(loginIntent); return true; } return super.onOptionsItemSelected(item); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.bLogin: String username = etUsername.getText().toString(); String password = etPassword.getText().toString(); User user = new User(username, password); authenticate(user); // user logged in and store it userLocalStore.storeUserData(user); userLocalStore.setUserLoggedIn(true); break; case R.id.tvRegisterLink: // start activity when clicked startActivity(new Intent(this, Register.class)); break; } }
private void logUserIn(User returnedUser) { userLocalStore.storeUserData(returnedUser); userLocalStore.setUserLoggedIn(true); startActivity(new Intent(this, MainActivity.class)); }