Use the SharedPreferences concept to store the password, and when starting the application, check it.
First save your data in the settings.
public void setSharedPreferences() { try { SharedPreferences sharedPreferences=getApplicationContext().getSharedPreferences("UserData", Context.MODE_PRIVATE); SharedPreferences.Editor editor=sharedPreferences.edit(); editor.putString("FirstName", StringUtils.capitalize(stringFirstName).trim()); editor.putString("LastName", StringUtils.capitalize(stringLastName).trim()); editor.putString("Email", stringEmail.toLowerCase().trim()); editor.putString("Password", stringPassword.trim()); editor.commit(); } catch (Exception e) { } }
Check it at the entrance to the application.
public boolean validateLogin(String email,String password) { try { SharedPreferences sharedPreferences=getApplicationContext().getSharedPreferences("UserData",Context.MODE_PRIVATE); if(email.toLowerCase().trim().equals(sharedPreferences.getString("Email",null)) && password.trim().equals(sharedPreferences.getString("Password",null))) { return true; } else { return false; } } catch (Exception e) { return false; } }
source share