將activity01中的資料傳輸到activity02中,**如下:
intent intent = new intent(this,activity.class);//宣告intent物件,
intent.putextra("extra_date","hello activity02");//用putextra()方法傳遞
intent引數(1,代表當前物件,預設this;2,代表要傳遞的activity頁面,注意:字尾為.class)
putextra(1,代表鍵(key)用於後面從intent中取值;2,傳遞的內容)
intent intent = getintent();//獲取intent物件
string
date
= intent.getstringextra("extra_date");//根據鍵值,取出資料
前面寫了乙個putextra,這裡用乙個getstringextra來接,利用(key,value)的方式來接。如果傳遞的是整數型別,則為.getintextra(),以此類推 Activity中的資料傳遞
在android開發中,經常要在activity之間傳遞資料。internet可以用來開啟activity,同樣他也可以用來在activity之間傳遞資料。在android開發中,經常要在activity之間傳遞資料。internet可以用來開啟activity,同樣他也可以用來在activity之...
Activity幾種資料傳遞的方法
4 在任何其他地方呼叫這個方法取出資料 2 剪下板來傳遞資料 1 得到剪下板物件 2 在另乙個activity中得到資料 clipboardmanager cbmanager clipboardmanager getsystemservice context.clipboard service cb...
ifream中的資料傳遞
以下兩種方法都是使用js 的方法!其他部分省略,只寫下關鍵的一句。方法一 parent.document.all.ifr.innerhtml ifream需要傳遞到上級窗體的值 parent 指定上級窗體 document 窗體物件 all 範圍為所有控制項 ifr 某乙個控制項的id 本例的id是...