I have an activity with two fragments, one to display a list and one to show the details of the clicked item. When starting the app the detail part is something static, once I c
Instead of using in layout xml fragment
:
<fragment
android:id="@+id/detailFragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
class="com.fragments.FragmentOrderDetails" >
</fragment>
Use some container like LinearLayout
or FrameLayout
with some containerId.
Then programatically firstly add fragment to this container using containerId, and after that replace content of this container with containerId also.