SharedPreferences sharedPreferences = this.getSharedPreferences("com.insertapplicationname.here", Context.MODE_PRIVATE);
//create
sharedPreferences.edit().putString("username", "leithdm").apply();
//read
String username = sharedPreferences.getString("username", "");
Log.i("username", username);