Пример #1
0
 public static synchronized boolean handleProvincesResponse(
     XiaoQiaoWeatherDB xiaoQiaoWeatherDB, String response) {
   if (TextUtils.isEmpty(response)) {
     String allProvinces[] = response.split(",");
     if (allProvinces != null && allProvinces.length > 0) {
       for (String p : allProvinces) {
         String array[] = p.split("\\|");
         Province province = new Province();
         province.setProvinceCode(array[0]);
         province.setProvinceName(array[1]);
         xiaoQiaoWeatherDB.saveProvince(province);
       }
       return true;
     }
   }
   return false;
 }
Пример #2
0
 public static synchronized boolean handleCountiesResponse(
     XiaoQiaoWeatherDB xiaoQiaoWeatherDB, 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);
         xiaoQiaoWeatherDB.saveCounty(county);
       }
       return true;
     }
   }
   return false;
 }
Пример #3
0
 public static boolean HandleCitiesResponse(
     XiaoQiaoWeatherDB xiaoQiaoWeatherDB, String response, int provinceId) {
   if (!TextUtils.isEmpty(response)) {
     String allCities[] = response.split(",");
     if (allCities != null && allCities.length > 0) {
       for (String c : allCities) {
         String array[] = c.split("\\|");
         City city = new City();
         city.setCityCode(array[0]);
         city.setCityName(array[1]);
         city.setProvinceId(provinceId);
         xiaoQiaoWeatherDB.saveCity(city);
       }
       return true;
     }
   }
   return false;
 }