为了账号安全,请及时绑定邮箱和手机立即绑定

Bundle bundle = this.getIntent().getExtras();什么意思?

Bundle bundle = this.getIntent().getExtras();什么意思?

HUX布斯 2018-10-14 18:14:13
public void uriToActivity(String name, String uri) { Intent intent = new Intent(); intent.setClass(ActivityMain.this, ActivityUser.class); Bundle bundle = new Bundle(); bundle.putString("name", name); bundle.putString("uri", uri); intent.putExtras(bundle); startActivity(intent); } //publicvoid onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Bundle bundle = this.getIntent().getExtras(); if (bundle != null) { uri = bundle.getString("uri"); name = bundle.getString("name"); } }
查看完整描述

1 回答

?
交互式爱情

TA贡献1712条经验 获得超3个赞

Bundle 是一个容器,专门给Intent传递消息的.内部的数据结构是KEY VALUE的键值对存在的;
Intent是一个传递消息的工具,
this.getIntent这个的意思是当前的Activity或者Service获取上一个给他传递的值,getExtras是得到Bundle这个容器里面的值;
Intent大部分的时候用来用来跳转界面,开启服务的;

查看完整回答
反对 回复 2018-11-13
  • 1 回答
  • 0 关注
  • 3781 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信