I am trying to make my application with SQL Server, but I do not know how to identify the user that has logged in, after closing and openin
Use the following code:
// to save in SharedPreferences in Login
private static final String MyPREFERENCES = "MyPreference";
private SharedPreferences sharedPreferences;
sharedPreferences = getSharedPreferences(MyPREFERENCES, MODE_PRIVATE);
SharedPreferences.Editor editor = getSharedPreferences(MyPREFERENCES, MODE_PRIVATE).edit();
editor.putString("username", "usernameValue");
editor.apply();
//to get data from SharedPreferences in Home Page
private static final String MyPREFERENCES = "MyPreference";
private SharedPreferences sharedPreferences;
sharedPreferences = getSharedPreferences(MyPREFERENCES, MODE_PRIVATE);
String username= SharedPreferences.getString("username", null);