EDIT :
After the recommendation of using TabStrip instead, I have been searching for it and I decided to used it instead of I was trying to do.
So the problem is still the same but different code:
In my navigation drawer I have a switch, which gives a Fragment fragment
a Fragment value, and when I extend my TodayFragment
with FragmentActivity
I can´t make the last assignment because it throws a type mismatch error.
So here is part of the code (TodayFragment is now TodayFrag because I'm trying things without erasing classes):
Fragment fragment = null;
switch (position) {
case 0:
fragment = new HomeFragment();
break;
case 1:
fragment = new TimetablesFragment();
break;
case 2:
fragment = new SubjectsFragment();
break;
case 3:
fragment = new TodayFrag();
break;
case 4:
fragment = new Others2Fragment();
break;
default:
break;
}
And now I have my PagerTabStrib from http://blog.pboos.ch/android-pagertabstrip-viewpager/ class:
public class TodayFrag extends FragmentActivity {}
ORIGINAL QUESTION:
I have my navigation drawer done, and in a certain point, i switch a position variable to determine which fragment I need to set in the view:
Fragment fragment = null;
switch (position) {
case 0:
fragment = new HomeFragment();
break;
case 1:
fragment = new OneFragment();
break;
case 2:
fragment = new TwoFragment();
break;
case 3:
fragment = new TodayFragment();
break;
case 4:
fragment = new Others2Fragment();
break;
default:
break;
}
All fragments are classes that just extends Fragment except for TodayFragment(). TodayFragment() extends Fragment and implements ActionBar.TabListener because I'm trying to achieve a tab swipeable view in one of the fragments of the Navigation drawer:
public class TodayFragment extends Fragment implements ActionBar.TabListener {}
The problem comes in the first part of the code, it says "Type mismatch: cannot convert from TodayFragment to Fragment"
I don't know too much Java, and I'm stuck.
I hope someone could help
Thanks in advance