Launch another activity if checkbox is checked
android, android-activity, checkbox, manifest
Solution
You probably want to save the username and checkbox value in the SharedPreferences. After that you can retrieve them when the application starts.
Example:
//Saving the values
SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("username",username);
editor.putString("password",password);
editor.putBoolean("isChecked", isCheckBoxChecked);
editor.commit();
//Retrieving the values
SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE);
if(sharedPreferences.getBoolean("isChecked"))
{
//Do whatever you need to do if it's checked
}
Problem
When my application starts, login Activity appears. It contains checkbox "sign me next time". I want to start another Activity next time of application starting and send username and password of user to it if checkbox was checked. How can I implement this?