I cannot find find FragmentPagerAdapter within Android.App.
I do not want to use the Fragment\'s from Android.Support.V4.App, as my target API is 14 and higher (Andr
Add this dependecy to the gradle dependencies:
compile 'com.android.support:support-v13:+'
And use android.support.v13.app.FragmentPagerAdapter like this (I simply modified the official demo project in android studio: file → new → new project → next → next → tabbed activity → next → finish):
import android.app.Fragment;
import android.app.FragmentManager;
import android.support.v13.app.FragmentPagerAdapter;
import com.google.android.gms.maps.MapFragment;
/** A simple FragmentPagerAdapter that returns a MapFragment and a PreferenceFragment. */
public class MainActivityAdapter extends FragmentPagerAdapter {
private MapFragment mapFragment;
private PreferencesFragment preferencesFragment;
public MainActivityAdapter(FragmentManager fm) {
super(fm);
mapFragment = MapFragment.newInstance();
preferencesFragment = new PreferencesFragment();
}
@Override
public int getCount() {
return 2;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return mapFragment;
case 1:
return preferencesFragment;
default:
return null;
}
}
}