Ejemplo n.º 1
0
 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");
   }
 }
Ejemplo n.º 2
0
 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");
   }
 }