Dynamically Adding And Removing Tabs Using Arraypageradapter
Solution 1:
One of the next blocks i'm getting stuck on right now is creating the PageDescriptor objects in the ArrayList passed into SimplePageAdapter
PageDescriptor
is an interface. Create your own class (e.g., BlainePageDescriptor
) that implements the interface. This is covered in the documentation.
I've tried copying and pasting the SimplePageDescriptor class used in the Demo into my code
That will not solve your problem.
Your problem, as I understand it, is that you want your ArrayPagerAdapter
to be able to handle N different types of pages (JudgeMainFragment
, JudgeClassifyFragment
, etc.). That requires you to return the proper fragment from createFragment()
, given the supplied PageDescriptor
. Hence, you need to create your own PageDescriptor
implementation (e.g., BlainePageDescriptor
). That class needs to hold onto sufficient information to both satisfy the PageDescriptor
interface and be able to tell createFragment()
what sort of fragment to create.
Post a Comment for "Dynamically Adding And Removing Tabs Using Arraypageradapter"