Reputation: 7569
I have created a fragment, and used this inside another Fragment layout.
This is the XML of my layout.
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/wv_facebook"
>
</WebView>
<fragment
class="com.loading.LoadingAnimation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/wv_facebook_loadingAnimation"
/>
Now i want to get the ID of this fragment
. I used following procedure but i am getting incompatible type
error message.
Loading Animation loadingAnimation;
loadingAnimation = (LoadingAnimation) getFragmentManager().findFragmentById(R.id.wv_facebook_loadingAnimation);
Required
LoadingAnimation
Found android.support.v4.app.fragment
Upvotes: 2
Views: 1337
Reputation: 2949
You may try below sample too:
DashboardFragment innerFragment = new DashboardFragment();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
innerFragment .setEnterTransition(new Slide(Gravity.RIGHT));
innerFragment .setExitTransition(new Slide(Gravity.LEFT));
}
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
folderName = mFileList.get(position).getName();
fragmentTransaction.add(R.id.content_frame, innerFragment, folderName);
fragmentTransaction.addToBackStack(folderName);
fragmentTransaction.commit();
Upvotes: 0
Reputation: 1710
You need to call getChildFragmentManager()
instead of getFragmentManager()
.
Upvotes: 4