I have came across a very strange problem, i am using Pager in android to navigate between different screens through fragments in android. also i am using another fragment class to create Layouts automatically in a grid,
for fragment 1, where i have used the pager and pageradapter i am using these imports
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
for the other fragment which i am using to populate images in a non linear Grid, i am using this import
import android.app.Fragment;
The issue is:
By using this import i am unable to add my fragments into the pageradapter. it keeps on giving me error.
private List<Fragment> getFragments(){
List<Fragment> fList = new ArrayList<Fragment>();
fList.add(MyFragment.newInstance("Tv Shows"));
fList.add(MyFragment.newInstance("Movies"));
fList.add(MyFragment.newInstance("Music Videos"));
return fList;
}
also i cannot initialize my pageadapter
pageAdapter = new MyPageAdapter(getSupportFragmentManager(), fragments);
it gives me error on this line to.
My Question is:
what is difference between the two imports
import android.support.v4.app.Fragment;
and
import android.app.Fragment;
is there any solution to the problem, ?