コード例 #1
0
 private void SetProvincesData() {
   adapter.data.clear();
   Iterator<Map.Entry<String, List<City>>> it = App.CITIES.entrySet().iterator();
   while (it.hasNext()) {
     Entry<String, List<City>> entry = (Entry<String, List<City>>) it.next();
     adapter.data.add(entry.getKey()); // 返回与此项对应的键
   }
   adapter.notifyDataSetChanged();
 }
コード例 #2
0
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
          if (isOnProvinces) {
            tvTitle.setText("城市选择");
            ProvinceAdapter.selectedId = -1;
            ELog.i("得到的城市信息:" + view.getTag());
            adapter.data.clear();
            List<City> tempList = App.CITIES.get(view.getTag());

            for (int i = 0; i < tempList.size(); i++) {
              adapter.data.add(tempList.get(i).getName());
            }

            adapter.notifyDataSetChanged();
            isOnProvinces = false;
          } else {
            ProvinceAdapter.selectedId = position;
            btnRight.setVisibility(View.VISIBLE);
            citystr = adapter.data.get(position);
            adapter.notifyDataSetChanged();
          }
        }