Ejemplo n.º 1
0
 public static synchronized boolean handleProvincesResponse(WeatherDB weatherDB, String response) {
   if (!TextUtils.isEmpty(response)) {
     String[] allProvinces = response.split(",");
     if (allProvinces.length > 0) {
       for (String p : allProvinces) {
         String[] array = p.split("|");
         Province province = new Province();
         province.setCode(array[0]);
         province.setName(array[1]);
         weatherDB.saveProvince(province);
       }
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 2
0
 public static synchronized boolean handleCountiesResponse(
     WeatherDB weatherDB, String response, int cityId) {
   if (!TextUtils.isEmpty(response)) {
     String[] allCounties = response.split(",");
     if (allCounties.length > 0) {
       for (String c : allCounties) {
         String[] array = c.split("|");
         County county = new County();
         county.setCode(array[0]);
         county.setName(array[1]);
         county.setCityId(cityId);
         weatherDB.saveCounty(county);
       }
       return true;
     }
   }
   return false;
 }