コード例 #1
0
 /** 根据当前的省,更新市WheelView的信息 */
 private void updateCities() {
   int pCurrent = mViewProvince.getCurrentItem();
   mCurrentProviceName = mProvinceDatas[pCurrent];
   String[] cities = mCitisDatasMap.get(mCurrentProviceName);
   if (cities == null) {
     cities = new String[] {""};
   }
   mViewCity.setViewAdapter(new ArrayWheelAdapter<String>(this, cities));
   mViewCity.setCurrentItem(0);
   updateAreas();
 }
コード例 #2
0
 private void setUpData() {
   initProvinceDatas();
   mViewProvince.setViewAdapter(
       new ArrayWheelAdapter<String>(ChooseCityActivity.this, mProvinceDatas));
   // 设置可见条目数量
   mViewProvince.setVisibleItems(7);
   mViewCity.setVisibleItems(7);
   mViewDistrict.setVisibleItems(7);
   updateCities();
   updateAreas();
 }
コード例 #3
0
 /** 根据当前的市,更新区WheelView的信息 */
 private void updateAreas() {
   int pCurrent = mViewCity.getCurrentItem();
   mCurrentCityName = mCitisDatasMap.get(mCurrentProviceName)[pCurrent];
   String[] areas = mDistrictDatasMap.get(mCurrentCityName);
   mCurrentDistrictName = mDistrictDatasMap.get(mCurrentCityName)[0];
   mCurrentZipCode = mZipcodeDatasMap.get(mCurrentDistrictName);
   if (areas == null) {
     areas = new String[] {""};
   }
   mViewDistrict.setViewAdapter(new ArrayWheelAdapter<String>(this, areas));
   mViewDistrict.setCurrentItem(0);
 }