package com.dahamit.dahammall.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

/**
 * Created by macbookpro on 15. 2. 9..
 */
public class PreferManager {


    // 값 불러오기
//    public static String getPreferences(Context thisActivity, String memberid, String prefId){
    public static String getPreferences(Context thisActivity, String prefId){
        String memberid = "ribl";
            String returnStr;
        SharedPreferences pref = thisActivity.getSharedPreferences(memberid, thisActivity.MODE_PRIVATE);
        returnStr = pref.getString(prefId, "");
        if(returnStr == null)
            returnStr = "";
        return returnStr;
    }
    // 값 저장하기
//    public static  void savePreferences(Activity thisActivity, String memberid, String prefId, String chkId){
    public static  void savePreferences(Context thisActivity, String prefId, String chkId){

        String memberid = "ribl";
        String saveStr;

        Log.e("pref","in savePreferences  "+prefId+">"+chkId);

        if(thisActivity == null){
            Log.e("null","in savePreferences thisActivity is null");
        }
        SharedPreferences pref = thisActivity.getSharedPreferences(memberid, thisActivity.MODE_PRIVATE);
        SharedPreferences.Editor editor = pref.edit();
         editor.putString(prefId,chkId);
        editor.commit();
    }
}
