Read SharedPreferences if you did not specify a file name

When you create a PreferenceScreen on Android, your application creates a default SharedPreferences file for the settings. I want to read this name or get a link without a name.

I am currently using:

SharedPreferences prefs = ctx.getSharedPreferences("prefs", 0); SharedPreferences.Editor ed=prefs.edit(); 

But this returns another copy of the preference. When I checked the folder in / data / data / myapk / shared _prefs

I see two files, one of which is called prefs.xml, and the other is my [package name] _preferences.xml (this was created by PreferenceActivity);

How to get an instance of shared preferences using the default file name, so I should not mention its name?

+6
android sharedpreferences
source share
1 answer
+13
source share

All Articles