How can I create a PagerView dynamically? Without using a xml? Let’s say that I have a xml layout like this:
<FrameLayout android:id="@+id/a_frame_for_pagerview"
... >
<!-- I WANT MY PAGERVIEW HERE BUT DYNAMICALLY, NO XML -->
</FrameLayout>
It don’t need to be a FrameLayout, just used it because I thought it would be the case.
Thanks for your help.
EDIT:
My main problem is that I have too many pagers that crash because of memory and I want them to be disposed but even I removing the Fragment where the pager is inside, it keeps reference to the older pager(from the first time I create the fragment) where all the fragments are destroyed, so nothing appears.
You can do it with :
In your XML :
In your frament :