1.startActivity(intent)
2.startActivityForResult:a.启动BActivity 请求码为0:startActivityForResult(intent,0);
b.重写onActivityResult(int requestCode,int resultCode,Intent data),回调的方式来获取指定Activity返回的结果;
c.在跳转后的页面回转:
//将数据放入Bundle对象中
Bundle bundle=new Bundle();
bundle.putString("name", city[1]);
bundle.putString("names", citys[1]);
// 获取启动该Activity之前的Activity对应的Intent
Intent intent=getIntent();
intent.putExtra("name", bundle);
//设置当前Activity的结果码
setResult(0, intent);
//关闭当前的Activity
finish();
时间: 2024-11-01 00:52:58