Android 将数据从片段活动传递到静态包含的片段
我在xml布局中定义了一个片段,我想从片段活动向它传递数据。可能吗?我不想在运行时包含片段,因为我不打算在活动的生命周期中更改片段。 这是我的xmlAndroid 将数据从片段活动传递到静态包含的片段,android,android-fragments,static,fragment,Android,Android Fragments,Static,Fragment,我在xml布局中定义了一个片段,我想从片段活动向它传递数据。可能吗?我不想在运行时包含片段,因为我不打算在活动的生命周期中更改片段。 这是我的xml <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <fragment android:id="@
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/profileFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
class="com.fragments.MyProfileFragment" >
</fragment>
<fragment
android:id="@+id/hoppiesFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
class="com.fragments.HoppiesFragment" >
</fragment>
</LinearLayout>
使用碎片管理器#findFragmentById
方法获取碎片并将数据传递给它的一些公共方法。你能接受答案吗?我已经接受了你的答案。谢谢:)非常感谢您的快速回复。:)我很高兴能帮上忙。