@@ -0,0 +1,2656 @@
+package com.example.test.myweather.httputil;%0A%0Aimport android.text.TextUtils;%0A%0Aimport com.example.test.myweather.database.City;%0Aimport com.example.test.myweather.database.County;%0Aimport com.example.test.myweather.database.MyWeatherDB;%0Aimport com.example.test.myweather.database.Province;%0A%0Aimport org.json.JSONException;%0Aimport org.json.JSONObject;%0A%0A/**%0A * Created by test on 8/18/2015.%0A */%0Apublic class Utility %7B%0A    public synchronized static boolean handleProvince(MyWeatherDB myWeatherDB, 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_name(array%5B1%5D);%0A                    province.setProvince_code(array%5B0%5D);%0A                    myWeatherDB.saveProvince(province);%0A                %7D%0A                return true;%0A            %7D%0A            return false;%0A        %7D%0A        return false;%0A    %7D%0A%0A    public synchronized static boolean handleCity%0A            (MyWeatherDB myWeatherDB, String response, int province_id) %7B%0A        if (!TextUtils.isEmpty(response)) %7B%0A            String%5B%5D allCities = response.split(%22,%22);%0A            if (allCities != null && allCities.length %3E 0) %7B%0A                for (String c : allCities) %7B%0A                    String%5B%5D array = c.split(%22%5C%5C%7C%22);%0A                    City city = new City();%0A                    city.setCity_name(array%5B1%5D);%0A                    city.setCity_code(array%5B0%5D);%0A                    city.setProvince_id(province_id);%0A                    myWeatherDB.saveCity(city);%0A                %7D%0A                return true;%0A            %7D%0A            return false;%0A        %7D%0A        return false;%0A    %7D%0A%0A    public synchronized static boolean handleCounty%0A            (MyWeatherDB myWeatherDB, String response, int city_id) %7B%0A        if (!TextUtils.isEmpty(response)) %7B%0A            String%5B%5D allCounties = response.split(%22,%22);%0A            if (allCounties != null && allCounties.length %3E 0) %7B%0A                for (String cou : allCounties) %7B%0A                    String%5B%5D array = cou.split(%22%5C%5C%7C%22);%0A                    County county = new County();%0A                    county.setCounty_name(array%5B1%5D);%0A                    county.setCounty_code(array%5B0%5D);%0A                    county.setCity_id(city_id);%0A                    myWeatherDB.saveCounty(county);%0A                %7D%0A                return true;%0A            %7D%0A            return false;%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

create Utility