private void login() { String email = inputEmail.getText().toString(); if (isValidEmail(email)) { pref.createLoginSession(email); Intent intent = new Intent(LoginActivity.this, MainActivity.class); startActivity(intent); finish(); } else { Toast.makeText( getApplicationContext(), "Please enter valid email address!", Toast.LENGTH_LONG) .show(); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Verifying parse configuration. This is method is for developers only. ParseUtils.verifyParseConfiguration(this); pref = new PrefManager(getApplicationContext()); if (pref.isLoggedIn()) { Intent intent = new Intent(LoginActivity.this, MainActivity.class); startActivity(intent); finish(); } setContentView(R.layout.activity_login); inputEmail = (EditText) findViewById(R.id.email); btnLogin = (Button) findViewById(R.id.btnLogin); btnLogin.setOnClickListener(this); }