Adroid中的两个Activity用Intent来传递实体
跳转至LoginActivity
Intent intent = new Intent();
intent.setClass(MenuActivity.this, LoginActivity.class);
startActivityForResult(intent, LoginCode);
LoginActivity处理页
Intent intent=new Intent();
intent.putExtra("UserModel", model);
setResult(RESULT_OK, intent);
finish();
MenuActivity处理结果
@Override
protected void onActivityResult(int sendcode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(sendcode, resultCode, data );
switch(sendcode)
{
case LoginCode:
if(resultCode==RESULT_OK)
{
UserModel uModel = (UserModel)data.getParcelableExtra("UserModel");
}
break;
}
}