/** 解析和处理服务器返回的县级数据 */ public static synchronized boolean handleCountiesResponse( CoolWeatherDB coolWeatherDB, String response, int cityId) { if (!TextUtils.isEmpty(response)) { String[] allCounties = response.split(","); if (allCounties != null && allCounties.length > 0) { for (String c : allCounties) { String[] array = c.split("\\|"); County county = new County(); county.setCountyCode(array[0]); county.setCountyName(array[1]); county.setCityId(cityId); // 将解析出来的数据存储到County表 coolWeatherDB.saveCounty(county); } return true; } } return false; }