/** 将服务器返回的天气信息存储到共享参数中 */ public static void saveWeatherInfo(Context context, Weatherinfo info) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy年M月d日", Locale.CHINA); SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit(); editor.putBoolean("city_selected", true); editor.putString("city_name", info.getCity()); editor.putString("weather_code", info.getCityid()); editor.putString("temp1", info.getTemp1()); editor.putString("temp2", info.getTemp2()); editor.putString("weather_desp", info.getWeather()); editor.putString("publish_time", info.getPtime()); LogUtil.i("UTILITY", "----------------->" + sdf.format(new Date())); editor.putString("current_date", sdf.format(new Date())); editor.commit(); }