To get the number of records you can use
sharedPreferencesInstance.getAll().size()
To get all the keys you saved earlier, you can use keySet() , as shown in the following snippet:
SharedPreferences prefs = this.getSharedPreferences("myshared", Context.MODE_PRIVATE); Map<String,?> entries = prefs.getAll(); Set<String> keys = entries.keySet(); for (String key : keys) { }
source share