Shared preferences
Let's launch the FourGoats app and register a new user using the register option. Once created, login using the credentials, I have used username as test
and test
as its password, as shown following:
Shared Preferences are created using the SharedPreferences
class. Below is the piece of code used to store the username and password in the credentials.xml
file:
public void saveCredentials(String paramString1, String paramString2) { SharedPreferences.Editor localEditor = getSharedPreferences("credentials", 1).edit(); localEditor.putString("username", paramString1); localEditor.putString("password", paramString2); localEditor.putBoolean("remember", true); localEditor.commit(); }
As discussed earlier, the app directory stores the shared preferences:
/data/data/<package name>/shared_prefs/<filename.xml>
So, let's browse and inspect the above path to see if there are any shared preferences created...