private void queryProvinces() { mProvinceList = coolWeatherDB.loadProvinces(); if (mProvinceList.size() > 0) { dataList.clear(); for (Province province : mProvinceList) { dataList.add(province.getProvinceName()); } adapter.notifyDataSetChanged(); listview.setSelection(0); // ? titleText.setText("中国"); currentLevel = LEVEL_PROVINCE; } else { queryFromServer(null, "province"); } }
private void queryCities() { mCityList = coolWeatherDB.loadCities(selectedProvince.getId()); if (mCityList.size() > 0) { dataList.clear(); for (City city : mCityList) { dataList.add(city.getCityName()); } adapter.notifyDataSetChanged(); listview.setSelection(0); titleText.setText(selectedProvince.getProvinceName()); currentLevel = LEVEL_CITY; } else { queryFromServer(selectedProvince.getProvinceCode(), "city"); } }