/**
     * 获取登陆标识,判断是否为首次登陆
     *
     * @return
     */
    public static int loadLoginFlag(Context mContext)
    {
        SharedPreferences preference = mContext.getSharedPreferences(GConst.HAIER_FIRST_LOGIN, Context.MODE_PRIVATE);

        // android.content.SharedPreferences.getInt(String key, int defValue)
        int flag = preference.getInt(GConst.FIRST_LOGIN, GConst.IS_FIRST_LOGIN);
        return flag;
    }

    /**
     * 保存时同时修改登陆标识为非首次登陆
     */
    public static void saveNotFirst(Context mContext)
    {
        SharedPreferences preference = mContext.getSharedPreferences(GConst.HAIER_FIRST_LOGIN, Context.MODE_PRIVATE);
        Editor editor = preference.edit();

        // android.content.SharedPreferences.Editor.putInt(String key, int value)
        editor.putInt(GConst.FIRST_LOGIN, GConst.NOT_FIRST_LOGIN);
        editor.commit();
    }

相关文章:

  • 2021-07-17
  • 2021-07-29
  • 2021-05-12
  • 2021-11-11
  • 2021-09-04
猜你喜欢
  • 2022-12-23
  • 2021-09-29
  • 2021-06-10
  • 2022-12-23
  • 2021-09-06
  • 2021-11-27
  • 2021-08-19
相关资源
相似解决方案