I want to know how many shared preference in my shared preferences which are found in the file explorer by coding , is there any method to return the total number of shared preferences ?

I want to know how many shared preference in my shared preferences which are found in the file explorer by coding , is there any method to return the total number of shared preferences ?

To get the number of entries you can use
sharedPreferencesInstance.getAll().size()
To retrieve all the keys you stored previously 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) {
}
In your activity try this:
SharedPreferences prefs = this.getSharedPreferences("your.package", Context.MODE_PRIVATE);
int howMany = prefs.getAll().size();
Not sure if you are looking to something like this . If it is just the size then you can just do a
SharedPreferences pref = getSharedPreferences(<NAME>, <MODE>);
pref.getAll().size();