how to save login credentials in android app

Shared preferences

Declare below static string variable

public static final String MY_PREFS_NAME = "MyPrefsFile";

Step1:- after login

Execute below code after call login method

SharedPreferences.Editor editor = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE).edit();
editor.putString("Password", pwd);
editor.putInt("loginInfo", loginid);
editor.apply();

here Logininfo and Password are keys to pass this info where we need to get it again, and pwd and loginid are variable where loginid and pwd available.

Step2:- Get value from shared preferences

SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE);
String mypwd = prefs.getString("Password", "default value");
int myId = prefs.getInt("loginInfo", default value);

now we have saved loginid and password and it can access through mypwd and myId variables.