get Preference - Android android.content

Android examples for android.content:SharedPreferences

Description

get Preference

Demo Code

import android.content.Context;

public class Main {

  /**/*from  w  w  w. ja va  2 s .c o  m*/
   * Method getPreference ...
   *
   * @param paramContext
   *          of type Context
   * @param paramString1
   *          of type String
   * @param paramString2
   *          of type String
   * @return String
   */
  public static String getPreference(Context paramContext, String paramString1, String paramString2) {
    return paramContext.getSharedPreferences("com.java2s.client", 0).getString(paramString1, paramString2);
  }

  /**
   * Method getPreference ...
   *
   * @param paramContext
   *          of type Context
   * @param paramString1
   *          of type String
   * @param paramString2
   *          of type int
   * @return int
   */
  public static int getPreference(Context paramContext, String paramString1, int paramString2) {
    return paramContext.getSharedPreferences("com.java2s.client", 0).getInt(paramString1, paramString2);
  }

}

Related Tutorials