Fix SharedPrefsBackupHelper so it doesn't hard code the paths to the files.

This took quite a bit of refactoring.
This commit is contained in:
Joe Onorato
2009-06-10 17:07:15 -07:00
parent 0b77453076
commit 23ecae3bbb
12 changed files with 236 additions and 88 deletions

View File

@@ -254,11 +254,19 @@ public abstract class Context {
* <p>Note: this is not generally useful for applications, since they should
* not be directly accessing the file system.
*
*
* @return String Path to the code and assets.
*/
public abstract String getPackageCodePath();
/**
* {@hide}
* Return the full path to the shared prefs file for the given prefs group name.
*
* <p>Note: this is not generally useful for applications, since they should
* not be directly accessing the file system.
*/
public abstract File getSharedPrefsFile(String name);
/**
* Retrieve and hold the contents of the preferences file 'name', returning
* a SharedPreferences through which you can retrieve and modify its

View File

@@ -129,6 +129,11 @@ public class ContextWrapper extends Context {
return mBase.getPackageCodePath();
}
@Override
public File getSharedPrefsFile(String name) {
return mBase.getSharedPrefsFile(name);
}
@Override
public SharedPreferences getSharedPreferences(String name, int mode) {
return mBase.getSharedPreferences(name, mode);