I'm creating an application and I have a FragmentPager that I use. To use FragmentPager I must support it with a FragmentPagerAdapter. I have an interface that I've built the called Nameable and I want to create an array list that you can put there Fragments that implements the Nameable interface.
I've tried those ways but it gives me an error, and I don't really know why because it's a java thing and there are a lot of examples like this over the internet.
This is what I've tried:
private ArrayList<Fragment extends Nameable> mFragmentList;
The error:
Syntax error on token "extends", , expected
Other thing (which is not so right way to do it but I tried it to)
private ArrayList<? extends Fragment & Nameable> mFragmentList;
The error:
Syntax error on token "&", , expected
Why does this statement give me an error? I'm pretty sure that's the right way to do it.
Thanks, Elad.