@@ -0,0 +1,2561 @@
+package com.example.test.coolweather.utility;%0A%0Aimport android.text.TextUtils;%0A%0Aimport com.example.test.coolweather.db.CoolWeatherDB;%0Aimport com.example.test.coolweather.model.City;%0Aimport com.example.test.coolweather.model.County;%0Aimport com.example.test.coolweather.model.Province;%0A%0A/**%0A * Created by test on 8/12/2015.%0A */%0Apublic class Utility %7B%0A    private synchronized static boolean handleProvinceResponse%0A            (CoolWeatherDB coolWeatherDB,String response) %7B%0A        if (!TextUtils.isEmpty(response)) %7B%0A            String%5B%5D allProvinces = response.split(%22,%22);%0A            if (allProvinces != null && allProvinces.length %3E 0) %7B%0A                for (String p : allProvinces) %7B%0A                    String%5B%5D array = p.split(%22%5C%5C%7C%22);%0A                    Province province = new Province();%0A                    province.setProvince_code(array%5B0%5D);%0A                    province.setProvince_name(array%5B1%5D);%0A                    coolWeatherDB.saveProvince(province);%0A                %7D%0A                return true;%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%0A    private synchronized static boolean handleCityResponse%0A            (CoolWeatherDB coolWeatherDB, String response, int province_id) %7B%0A        if (!TextUtils.isEmpty(response)) %7B%0A            String%5B%5D allCitys = response.split(%22,%22);%0A            if (allCitys != null && allCitys.length %3E 0) %7B%0A                for (String c : allCitys) %7B%0A                    City city = new City();%0A                    String%5B%5D array = c.split(%22%5C%5C%7C%22);%0A                    city.setCity_code(array%5B0%5D);%0A                    city.setCity_name(array%5B1%5D);%0A                    city.setProvince_id(province_id);%0A                    coolWeatherDB.saveCity(city);%0A                %7D%0A                return true;%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%0A    private synchronized static boolean handleCountyResponse%0A            (CoolWeatherDB coolWeatherDB, String response, int city_id) %7B%0A        if (!TextUtils.isEmpty(response)) %7B%0A            String%5B%5D allCountys = response.split(%22,%22);%0A            if (allCountys != null && allCountys.length %3E 0) %7B%0A                for (String co : allCountys) %7B%0A                    County county = new County();%0A                    String%5B%5D array = co.split(%22%5C%5C%7C%22);%0A                    county.setCounty_code(array%5B0%5D);%0A                    county.setCounty_name(array%5B1%5D);%0A                    county.setCity_id(city_id);%0A                    coolWeatherDB.saveCounty(county);%0A                %7D%0A                return true;%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

create Utility to parse the response from server