/** 查询选中市内所有的县,优先从数据库中查询,如果没有查询到再去服务器上查询 */ private void queryCounties() { countyList = terrificWeatherDB.loadCounties(selectedCity.getId()); if (countyList.size() > 0) { dataList.clear(); for (County county : countyList) { dataList.add(county.getCountyName()); } adapter.notifyDataSetChanged(); listView.setSelection(0); titleText.setText(selectedCity.getCityName()); currentLevel = LEVEL_COUNTY; } else { queryFromServer(selectedCity.getCityCode(), "county"); } }
/** 查询选中省份内所有的市,优先从数据库中查询,如果没有再到服务器上查询 */ private void queryCites() { cityList = terrificWeatherDB.loadCities(selectedProvince.getId()); if (cityList.size() > 0) { dataList.clear(); for (City city : cityList) { dataList.add(city.getCityName()); } adapter.notifyDataSetChanged(); listView.setSelection(0); titleText.setText(selectedProvince.getProvinceName()); currentLevel = LEVEN_CITY; } else { queryFromServer(selectedProvince.getProvinceCode(), "city"); } }