Reputation: 3232
i used this layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="sanjaqak.com.karaoke.artist.AllArtistActivity">
<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="sanjaqak.com.karaoke.Srch.SrchSubFrag"
android:id="@+id/fragment2"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
this fragment must have argument to work. but i don't know how can initialize argument for this. i am very sorry for bad speak English.
Upvotes: 0
Views: 918
Reputation: 16914
AFAIK this is not possible with the current Fragment framework.
In such cases I just create the parent ViewGroup (usually a simple FrameLayout) for the Fragment that needs correct runtime arguments to work, and load that Fragment with those Arguments in the Activity's / parent Fragment's setup phase (usually in .onCreate()
) into that ViewGroup.
Upvotes: 1