Android Open Source - Abidan Share Pref






From Project

Back to project page Abidan.

License

The source code is released under:

Apache License

If you think the Android project Abidan listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.poepoemyintswe.abidan.utils;
//from w w w.j  a  va2  s. co m
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

/**
 * Created by poepoe on 10/15/14.
 */
public class SharePref {

  private static final String PREF_DATABASE = "pref_database";
  private static final String PREF_FIRST_TIME_CHECK = "pref_first_time_check";

  private static SharePref pref;
  protected SharedPreferences mSharedPreferences;
  protected SharedPreferences.Editor mEditor;
  protected Context mContext;

  public SharePref(Context context) {
    mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
    mEditor = mSharedPreferences.edit();
    this.mContext = context;
  }

  public static synchronized SharePref getInstance(Context mContext) {
    if (pref == null) {
      pref = new SharePref(mContext);
    }
    return pref;
  }

  public boolean isFirstTime() {
    return mSharedPreferences.getBoolean(PREF_FIRST_TIME_CHECK, true);
  }

  public void noLongerFirstTime() {
    mEditor.putBoolean(PREF_FIRST_TIME_CHECK, false);
  }

  public void saveDB(String key) {
    mEditor.putString(PREF_DATABASE, key);
    mEditor.commit();
  }

  public String geDB() {
    return mSharedPreferences.getString(PREF_DATABASE, null);
  }
}




Java Source Code List

com.poepoemyintswe.abidan.ApplicationTest.java
com.poepoemyintswe.abidan.Config.java
com.poepoemyintswe.abidan.SearchActivity.java
com.poepoemyintswe.abidan.adapter.WordAdapter.java
com.poepoemyintswe.abidan.async.WordAsync.java
com.poepoemyintswe.abidan.db.DBHelper.java
com.poepoemyintswe.abidan.models.Word.java
com.poepoemyintswe.abidan.utils.SharePref.java