當使用Fragment時,如果想要在不同Fragment間傳遞資料,

可以使用setTag方法,範例程式(假設有兩個頁籤fragment1, fragment2;在fragment1中傳給fragment2)如下:

 

View v;

v = inflater.inflate(R.layout.frament2, container,false);

LinearLayout ll = (LinearLayout) v2.findViewById(R.id.f2_layout); //假設fragment2中有一個linear layout

ll.setTag(parameter);

創作者介紹
創作者 jwjwo星象玩玩看 的頭像
u2b

jwjwo星象玩玩看

u2b 發表在 痞客邦 留言(0) 人氣( 72 )