第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

我如何從Android的意圖中獲得額外的數(shù)據(jù)?

我如何從Android的意圖中獲得額外的數(shù)據(jù)?

開(kāi)滿天機(jī) 2019-06-04 17:32:27
我如何從Android的意圖中獲得額外的數(shù)據(jù)?如何將數(shù)據(jù)從一個(gè)活動(dòng)(意圖)發(fā)送到另一個(gè)活動(dòng)(意圖)?我使用此代碼發(fā)送數(shù)據(jù):Intent i=new Intent(context,SendMessage.class);i.putExtra("id", user.getUserAccountId()+""); i.putExtra("name", user.getUserFullName());context.startActivity(i);
查看完整描述

3 回答

?
Smart貓小萌

TA貢獻(xiàn)1911條經(jīng)驗(yàn) 獲得超7個(gè)贊

首先,獲取已使用getIntent()方法:

Intent intent = getIntent();

如果額外的數(shù)據(jù)表示為字符串,則可以使用intent.getStringExtra(String name)方法。就你而言:

String id = intent.getStringExtra("id");String name = intent.getStringExtra("name");


查看完整回答
反對(duì) 回復(fù) 2019-06-04
?
翻閱古今

TA貢獻(xiàn)1780條經(jīng)驗(yàn) 獲得超5個(gè)贊

在接收活動(dòng)中

Bundle extras = getIntent().getExtras(); String userName;if (extras != null) {
    userName = extras.getString("name");
    // and get whatever type user account id is}


查看完整回答
反對(duì) 回復(fù) 2019-06-04
?
拉丁的傳說(shuō)

TA貢獻(xiàn)1789條經(jīng)驗(yàn) 獲得超8個(gè)贊

//  How to send value using intent from one class to another class//  class A(which will send data)
    Intent theIntent = new Intent(this, B.class);
    theIntent.putExtra("name", john);
    startActivity(theIntent);//  How to get these values in another class//  Class B
    Intent i= getIntent();
    i.getStringExtra("name");//  if you log here i than you will get the value of i i.e. john


查看完整回答
反對(duì) 回復(fù) 2019-06-04
  • 3 回答
  • 0 關(guān)注
  • 583 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)