Java Code Examples for android.content.Context#getSharedPreferencesPath()
The following examples show how to use
android.content.Context#getSharedPreferencesPath() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { synchronized (ContextImpl.class) { final File source = sourceContext.getSharedPreferencesPath(name); final File target = getSharedPreferencesPath(name); final int res = moveFiles(source.getParentFile(), target.getParentFile(), source.getName()); if (res > 0) { // We moved at least one file, so evict any in-memory caches for // either location final ArrayMap<File, SharedPreferencesImpl> cache = getSharedPreferencesCacheLocked(); cache.remove(source); cache.remove(target); } return res != -1; } }
Example 2
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { synchronized (ContextImpl.class) { final File source = sourceContext.getSharedPreferencesPath(name); final File target = getSharedPreferencesPath(name); final int res = moveFiles(source.getParentFile(), target.getParentFile(), source.getName()); if (res > 0) { // We moved at least one file, so evict any in-memory caches for // either location final ArrayMap<File, SharedPreferencesImpl> cache = getSharedPreferencesCacheLocked(); cache.remove(source); cache.remove(target); } return res != -1; } }
Example 3
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { synchronized (ContextImpl.class) { final File source = sourceContext.getSharedPreferencesPath(name); final File target = getSharedPreferencesPath(name); final int res = moveFiles(source.getParentFile(), target.getParentFile(), source.getName()); if (res > 0) { // We moved at least one file, so evict any in-memory caches for // either location final ArrayMap<File, SharedPreferencesImpl> cache = getSharedPreferencesCacheLocked(); cache.remove(source); cache.remove(target); } return res != -1; } }
Example 4
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { synchronized (ContextImpl.class) { final File source = sourceContext.getSharedPreferencesPath(name); final File target = getSharedPreferencesPath(name); final int res = moveFiles(source.getParentFile(), target.getParentFile(), source.getName()); if (res > 0) { // We moved at least one file, so evict any in-memory caches for // either location final ArrayMap<File, SharedPreferencesImpl> cache = getSharedPreferencesCacheLocked(); cache.remove(source); cache.remove(target); } return res != -1; } }
Example 5
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { synchronized (ContextImpl.class) { final File source = sourceContext.getSharedPreferencesPath(name); final File target = getSharedPreferencesPath(name); final int res = moveFiles(source.getParentFile(), target.getParentFile(), source.getName()); if (res > 0) { // We moved at least one file, so evict any in-memory caches for // either location final ArrayMap<File, SharedPreferencesImpl> cache = getSharedPreferencesCacheLocked(); cache.remove(source); cache.remove(target); } return res != -1; } }
Example 6
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { synchronized (ContextImpl.class) { final File source = sourceContext.getSharedPreferencesPath(name); final File target = getSharedPreferencesPath(name); final int res = moveFiles(source.getParentFile(), target.getParentFile(), source.getName()); if (res > 0) { // We moved at least one file, so evict any in-memory caches for // either location final ArrayMap<File, SharedPreferencesImpl> cache = getSharedPreferencesCacheLocked(); cache.remove(source); cache.remove(target); } return res != -1; } }
Example 7
Source File: ContextImpl.java From AndroidComponentPlugin with Apache License 2.0 | 6 votes |
@Override public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { synchronized (ContextImpl.class) { final File source = sourceContext.getSharedPreferencesPath(name); final File target = getSharedPreferencesPath(name); final int res = moveFiles(source.getParentFile(), target.getParentFile(), source.getName()); if (res > 0) { // We moved at least one file, so evict any in-memory caches for // either location final ArrayMap<File, SharedPreferencesImpl> cache = getSharedPreferencesCacheLocked(); cache.remove(source); cache.remove(target); } return res != -1; } }
Example 8
Source File: ContextImpl.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@Override public boolean moveSharedPreferencesFrom(Context sourceContext, String name) { synchronized (ContextImpl.class) { final File source = sourceContext.getSharedPreferencesPath(name); final File target = getSharedPreferencesPath(name); final int res = moveFiles(source.getParentFile(), target.getParentFile(), source.getName()); if (res > 0) { // We moved at least one file, so evict any in-memory caches for // either location final ArrayMap<File, SharedPreferencesImpl> cache = getSharedPreferencesCacheLocked(); cache.remove(source); cache.remove(target); } return res != -1; } }