亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

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 關注
  • 3925 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號