SharedPreferences prefs = getSharedPreferences(getPathForUser(username, password) + PREF_RESOURCES_NAME, MODE_PRIVATE);
public static String getPathForUser(String username, String password) {
String sUsername = null;
String sPassword = null;
// sUsername
if (username != null && username.trim().length() > 0) {
sUsername = username.trim();
} else {
sUsername = "defaultUsername";
}
// sPassword
if (password != null && password.trim().length() > 0) {
sPassword = password.trim();
} else {
sPassword = "defaultPassword";
}
try {
return URLEncoder.encode(sUsername, "UTF-8") + "__" + URLEncoder.encode(sPassword, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return "";
}
}