当前位置: 首页>>代码示例>>Java>>正文


Java SharedPreferences.getAll方法代码示例

本文整理汇总了Java中android.content.SharedPreferences.getAll方法的典型用法代码示例。如果您正苦于以下问题:Java SharedPreferences.getAll方法的具体用法?Java SharedPreferences.getAll怎么用?Java SharedPreferences.getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.SharedPreferences的用法示例。


在下文中一共展示了SharedPreferences.getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkForWallets

import android.content.SharedPreferences; //导入方法依赖的package包/类
public void checkForWallets(Context c) {
    // Full wallets
    File[] wallets = c.getFilesDir().listFiles();
    if (wallets == null) {
        return;
    }
    for (int i = 0; i < wallets.length; i++) {
        if (wallets[i].isFile()) {
            if (wallets[i].getName().length() == 40) {
                add(new FullWallet("0x" + wallets[i].getName(), wallets[i].getName()), c);
            }
        }
    }

    // Watch only
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(c);
    Map<String, ?> allEntries = preferences.getAll();
    for (Map.Entry<String, ?> entry : allEntries.entrySet()) {
        if (entry.getKey().length() == 42 && !mapdb.contains(entry.getKey()))
            add(new WatchWallet(entry.getKey()), c);
    }
    if (mapdb.size() > 0)
        save(c);
}
 
开发者ID:manuelsc,项目名称:Lunary-Ethereum-Wallet,代码行数:25,代码来源:WalletStorage.java

示例2: getAll

import android.content.SharedPreferences; //导入方法依赖的package包/类
/**
 * 返回所有的键值对
 *
 * @param context
 * @return
 */
public static Map<String, ?> getAll(Context context)
{
    SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
            Context.MODE_PRIVATE);
    return sp.getAll();
}
 
开发者ID:xiaobaima520gyj,项目名称:imooc-imi-app,代码行数:13,代码来源:SPUtils.java

示例3: migrate

import android.content.SharedPreferences; //导入方法依赖的package包/类
private void migrate() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
        return;
    }
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context);
    Map<String, ?> passwords = pref.getAll();
    for (String key : passwords.keySet()) {
        if (key.contains("-pwd")) {
            String address = key.replace("-pwd", "");
            try {
                KS.put(context, address.toLowerCase(), PasswordManager.getPassword(address, context));
            } catch (Exception ex) {
                Toast.makeText(context, "Could not process passwords.", Toast.LENGTH_LONG)
                        .show();
                ex.printStackTrace();
            }
        }
    }
}
 
开发者ID:TrustWallet,项目名称:trust-wallet-android,代码行数:20,代码来源:TrustPasswordStore.java

示例4: doInBackground

import android.content.SharedPreferences; //导入方法依赖的package包/类
@Override
protected Void doInBackground(Void... params) {
    SharedPreferences sp = CacheHelper.getPreferences(CacheHelper.FAV);
    Map<String, ?> map = sp.getAll();
    for (Map.Entry<String, ?> entry : map.entrySet()) {
        if (entry.getValue() instanceof Integer) {
            Integer testId = (Integer) entry.getValue();
            mData.add(readTestCache(testId));
        }
    }
    return null;
}
 
开发者ID:FallenCrood,项目名称:Review-,代码行数:13,代码来源:FavListFragment.java

示例5: getAllNotes

import android.content.SharedPreferences; //导入方法依赖的package包/类
public static List<Note> getAllNotes(Context context) {
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
    List<Note> noteList = new ArrayList<>();
    Map<String, ?> key = sharedPreferences.getAll();
    for (Map.Entry<String, ?> entry : key.entrySet()) {
        String savedValue = (String) entry.getValue();

        if (savedValue != null) {
            Note note = new Note(entry.getKey(), savedValue);
            noteList.add(note);
        }
    }
    return noteList;
}
 
开发者ID:PacktPublishing,项目名称:Android-Wear-Projects,代码行数:15,代码来源:SharedPreferencesUtils.java

示例6: getAllEntries

import android.content.SharedPreferences; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private List<Map.Entry<String, Integer>> getAllEntries(Context context) {
    final SharedPreferences preferences = getSharedPreferences(context);
    final Map<String, ?> allPreferences = preferences.getAll();

    return DictionaryUtil.sortHashMapByValues((HashMap<String, Integer>) allPreferences);
}
 
开发者ID:OhMyLob,项目名称:Paper-Launcher,代码行数:8,代码来源:DockAppsHelper.java

示例7: getAll

import android.content.SharedPreferences; //导入方法依赖的package包/类
/**
 * 返回所有的键值对
 *
 * @return
 */
public static Map<String, ?> getAll()
{
    SharedPreferences sp = ContextHolder.getContext().getSharedPreferences(FILE_NAME,
            Context.MODE_PRIVATE);
    return sp.getAll();
}
 
开发者ID:yzzslow0,项目名称:Ec2m,代码行数:12,代码来源:SPUtils.java

示例8: detectGpsMode

import android.content.SharedPreferences; //导入方法依赖的package包/类
public static boolean detectGpsMode(SharedPreferences preferences) {
   	Map<String, ?> prefs = preferences.getAll();
   	Boolean mode = (Boolean) prefs.get(PREF_GPS_MODE);
   	if (mode == null) {
   		// detect default mode
   		mode = Constants.SDK_VERSION < 9; // true - allowed
   		if (DEBUG) {
   			Log.d(TAG, "Detected " + PREF_GPS_MODE + " " + mode);
   		}
   		// update preferences
   		Editor editor = preferences.edit();
   		editor.putBoolean(PREF_GPS_MODE, mode).commit();
   	}
   	return mode;
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:16,代码来源:GpsPrefs.java

示例9: SampleContentDb

import android.content.SharedPreferences; //导入方法依赖的package包/类
private SampleContentDb(Context context) {
    mContext = context.getApplicationContext();
    SharedPreferences sampleLocalDbPrefs = mContext.getSharedPreferences(SAMPLE_LOCAL_DB,
            Context.MODE_PRIVATE);
    // Creating a copy of the set instance returned by getStringSet since the consistency of the
    // stored data is not guaranteed if the content is modified according to the docs.
    Set<String> removedClips = sampleLocalDbPrefs.getStringSet(REMOVED_CLIPS_KEY,
            new HashSet<String>());
    mRemovedClips = new HashSet<>(removedClips);

    SharedPreferences clipsProgressPrefs = context.getSharedPreferences(CLIPS_PROGRESS_DB,
            Context.MODE_PRIVATE);
    Map<String, Long> clipsProgress = (Map<String, Long>) clipsProgressPrefs.getAll();
    mClipsProgress = new HashMap<>(clipsProgress);
}
 
开发者ID:googlesamples,项目名称:leanback-homescreen-channels,代码行数:16,代码来源:SampleContentDb.java

示例10: getAll

import android.content.SharedPreferences; //导入方法依赖的package包/类
/**
 * 返回所有的键值对
 */
public static Map<String,?> getAll(Context context){

    SharedPreferences sp = context.getSharedPreferences(getSpName(context),Context.MODE_PRIVATE);
    return sp.getAll();
}
 
开发者ID:popo1379,项目名称:popomusic,代码行数:9,代码来源:SPUtil.java

示例11: getAll

import android.content.SharedPreferences; //导入方法依赖的package包/类
/**
 * Get all the shared preferences as a map of strings and objects (will need to be casted)
 */
public static Map<String, ?> getAll(Context context) {
    SharedPreferences settings = context.getSharedPreferences(PREF_FILE, 0);
    return settings.getAll();
}
 
开发者ID:albertogiunta,项目名称:justintrain-client-android,代码行数:8,代码来源:SharedPreferencesHelper.java

示例12: getAll

import android.content.SharedPreferences; //导入方法依赖的package包/类
public static Map<String, ?> getAll(Context context, String fileName) {
    SharedPreferences sp = SharedPreferencesImpl.getSharedPreferences(context, getFileName(fileName),
            Context.MODE_PRIVATE);
    return sp.getAll();
}
 
开发者ID:miLLlulei,项目名称:Accessibility,代码行数:6,代码来源:SPUtils.java

示例13: getAll

import android.content.SharedPreferences; //导入方法依赖的package包/类
public static Map<String, ?> getAll(Context context, String spName) {
    SharedPreferences sp = context.getSharedPreferences(spName,
            Context.MODE_PRIVATE);
    return sp.getAll();
}
 
开发者ID:dueros,项目名称:dcs-sdk-java,代码行数:6,代码来源:PreferenceUtil.java

示例14: getAll

import android.content.SharedPreferences; //导入方法依赖的package包/类
/**
 * 返回所有的键值对
 *
 * @return
 */
public static Map<String, ?> getAll() {
    SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
            Context.MODE_PRIVATE);
    return sp.getAll();
}
 
开发者ID:ZhouKanZ,项目名称:SweepRobot,代码行数:11,代码来源:SpUtils.java

示例15: getAllMap

import android.content.SharedPreferences; //导入方法依赖的package包/类
public Map<String, Object> getAllMap() {
	SharedPreferences sharePre = ctx.getSharedPreferences(FileName,
			Context.MODE_PRIVATE);
	return (Map<String, Object>) sharePre.getAll();
}
 
开发者ID:FacePlusPlus,项目名称:MegviiFacepp-Android-SDK,代码行数:6,代码来源:SharedUtil.java


注:本文中的android.content.SharedPreferences.getAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。