當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。