Android Context Get getEditor( Context ctx)

Here you can find the source of getEditor( Context ctx)

Description

get Editor

Declaration

public static synchronized SharedPreferences.Editor getEditor(
            Context ctx) 

Method Source Code

//package com.java2s;
import android.content.Context;
import android.content.SharedPreferences;

public class Main {
    private static SharedPreferences sSharedPreferences;

    public static synchronized SharedPreferences.Editor getEditor(
            Context ctx) {//  ww  w  . j a  v a2  s  .  c o m
        return getDefaultSharedPreferences(ctx).edit();
    }

    /**
     * Does file IO on calling thread. Can use {@link #getDefaultSharedPrefsAsync(android.content.Context, couk.doridori.android.lib.prefs.AbsPrefsHelper.PrefsLoader)} if on UI
     *
     * @param context
     * @return
     */
    public static synchronized SharedPreferences getDefaultSharedPreferences(
            Context context) {
        if (sSharedPreferences == null)
            sSharedPreferences = context.getSharedPreferences(
                    "defaultPrefs", Context.MODE_PRIVATE);

        return sSharedPreferences;
    }
}

Related

  1. getDensityDimen(Context context, int dimen)
  2. getDiskCacheDir(Context context, String uniqueName)
  3. getDisplayMetrics(Context context)
  4. getDisplayPhoto(Context context, long photoFileId)
  5. getDpiToPix(Context ctx)
  6. getExternalCacheDir(Context context)
  7. getExternalCacheDir(Context context)
  8. getExternalCacheDir(Context context)
  9. getFAFont(Context context)