intent传递对象
listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// TODO Auto-generated method stub
CigaretteUrl cigaretteUrl = (CigaretteUrl) parent
.getItemAtPosition(position);
Intent intent = new Intent(ac, CigaretteDetailsActivity.class);
Bundle bundle = new Bundle();
bundle.putSerializable("cigaretteUrl", cigaretteUrl);
intent.putExtras(bundle);
startActivity(intent);
ConstantUtils.isHomeKeyDown = false;
}
});
intent接收对象
Intent intent=getIntent();
cigaretteUrl=(CigaretteUrl) intent.getSerializableExtra("cigaretteUrl");
传递的对象必须实现Serializable