private void setClockTime() { int hour = (int) SharedPreferenceUtil.get(this, Constant.SHARE_CLOCK_HOUR, 0); int min = (int) SharedPreferenceUtil.get(this, Constant.SHARE_CLOCK_MIN, 0); boolean isOpen = (boolean) SharedPreferenceUtil.get(this, Constant.SHARE_CHECK_BOX_CLOCK, false); tvClock.setText(parseText(hour) + " : " + parseText(min)); tvClockOnOff.setText(isOpen ? "开" : "关"); }
private void firstEnter() { if (mLiteBlueService != null) { // 确认蓝牙 if (!mLiteBlueService.isEnable()) { showIosDialog(); } else { if (mLiteBlueService.isBinded()) { // 当本地绑定时,开启搜索。 mLiteBlueService.startScanUsePeriodScanCallback(); } } } // 加载天气 LoadWeatherJsonTask taskFirst = new LoadWeatherJsonTask(MSG_FORECAST, this, mHandler); taskFirst.setOnProgressChangeListener(this); String city = (String) SharedPreferenceUtil.get(this, Constant.SHARE_PLACE, "beijing"); if (!city.equals("")) { taskFirst.execute(YahooUtil.getForecastUrl(city)); tvWeatherAddress.setText(city); } else { } }
public void chooseLau(String language) { Resources res = getResources(); Configuration config = res.getConfiguration(); DisplayMetrics dm = res.getDisplayMetrics(); if (language.equals("zh")) { config.locale = Locale.SIMPLIFIED_CHINESE; } else if (language.equals("en")) { config.locale = Locale.ENGLISH; } res.updateConfiguration(config, dm); SharedPreferenceUtil.put(getActivity(), Constant.SHARE_LOCALE, language); }
/** 记载上次信息 */ private void loadLastWeather() { String lastJson = (String) SharedPreferenceUtil.get(this, Constant.SHARE_JSON_FORECAST, ""); parseForecastJsonAndUpdateView(lastJson); }
public int getWeight() { int weight = (int) SharedPreferenceUtil.get(getActivity(), Constant.SHARE_PEDOMETER_WEIGHT, 65); return weight; }
public int getHeight() { int height = (int) SharedPreferenceUtil.get(getActivity(), Constant.SHARE_PEDOMETER_HEIGHT, 175); return height; }