當使用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);
請先 登入 以發表留言。