how to know how many shared preference in shared preferences in android -
i want know how many shared preference in shared preferences found in file explorer coding , there method return total number of shared preferences ?
to number of entries can use
sharedpreferencesinstance.getall().size()
to retrieve keys stored can use keyset()
, shown in following snippet:
sharedpreferences prefs = this.getsharedpreferences("myshared", context.mode_private); map<string,?> entries = prefs.getall(); set<string> keys = entries.keyset(); (string key : keys) { }
Comments
Post a Comment