传递者:

listView_Province.setOnItemClickListener(new OnItemClickListener() {

   @Override
   public void onItemClick(AdapterView<?> parent, View view, int position,
     long id) {
     Province currProvince = adapter_Province.getItem(position);// 获取当前被选中的省份
     List<City> list_city = currProvince.getList_city();// 获取该省份的城市的集合
     Intent  intent=new Intent(ProvinceActivity.this,CityActivity.class);
     Bundle bundle=new Bundle();
     bundle.putSerializable("list_city", (Serializable) list_city);
     bundle.putSerializable("list_district", (Serializable) list_district);
     intent.putExtras(bundle);
     startActivity(intent);
   }
  });

接收者:

   listView_City = (ListView) findViewById(R.id.listView_City);

   Intent intent=getIntent();
    list_city=(List<City>) intent.getSerializableExtra("list_city");
   
   listView_City.setAdapter(new ArrayAdapter<City>(CityActivity.this, android.R.layout.simple_list_item_1,list_city));

posted on 2016-01-05 13:45  Jinger1992223  阅读(1269)  评论(0编辑  收藏  举报