示例#1
0
 public static synchronized boolean handProvinceResponse(
     String respnse, CoolWeatherDB coolWeatherDB) {
   if (!TextUtils.isEmpty(respnse)) {
     String[] allProvince = respnse.split(",");
     if (allProvince != null && allProvince.length > 0) {
       for (String p : allProvince) {
         String[] pro = p.split("\\|");
         Province province = new Province();
         province.setProvinceCode(pro[0]);
         province.setProvinceName(pro[1]);
         coolWeatherDB.saveProvince(province);
       }
       return true;
     }
   }
   return false;
 }
示例#2
0
 public static synchronized boolean handCountyResponse(
     String response, CoolWeatherDB coolWeatherDB, int cityId) {
   if (!TextUtils.isEmpty(response)) {
     String[] allCounty = response.split(",");
     if (allCounty != null && allCounty.length > 0) {
       for (String p : allCounty) {
         String[] coun = p.split("\\|");
         County county = new County();
         county.setCountyCode(coun[0]);
         county.setCountyName(coun[1]);
         county.setCityId(cityId);
         coolWeatherDB.saveCounty(county);
       }
       return true;
     }
   }
   return false;
 }