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

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", ...

Get Penetration Testing: A Survival Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.