示例#1
0
 public void saveCounty(County county) {
   if (county != null) {
     ContentValues values = new ContentValues();
     values.put("county_name", county.getCountyName());
     values.put("county_code", county.getCountyCode());
     values.put("city_id", county.getCityId());
     db.insert("County", null, values);
   }
 }
 private void queryCounty() {
   countyList = db.getCounties(selectedCity.getId());
   if (countyList.size() > 0) {
     dataList.clear();
     for (County c : countyList) {
       dataList.add(c.getCountyName());
     }
     adapter.notifyDataSetChanged();
     listview.setSelection(0);
     title.setText(selectedCity.getCityName());
     currentLevel = LEVEL_COUNTY;
   } else {
     queryServer(selectedCity.getCityCode(), "county");
   }
 }
示例#3
0
 /** 查询选中市内所有的县,优先从数据库查询,如果没有查询到再去服务器上查询。 */
 private void queryCounties() {
   countyList = coolWeatherDB.loadCounties(selectedCity.getCityName());
   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");
   }
 }