FindNetworkActivity.SectionsPagerAdapter

public class SectionsPagerAdapter extends FragmentPagerAdapter

A FragmentPagerAdapter that returns a fragment corresponding to one of the two available tabs: From, for location-based networks, and Speaks, for language-based networks.

Constructors

SectionsPagerAdapter

SectionsPagerAdapter(FragmentManager fm)

{@inheritDoc}

Parameters:

Methods

getCount

public int getCount()

Always returns 2 because there are 2 tabs

Returns:Always 2

getItem

public Fragment getItem(int position)

Get the appropriate fragment depending on which tab is selected

Parameters:
  • position – Either 0, for near or 1, for speaks
Returns:

FindLocationFragment for position=1, FindLanguageFragment otherwise.

getPageTitle

public CharSequence getPageTitle(int position)

Get the titles for each tab

Parameters:
  • position – Position of tab to get name of (0 or 1)
Returns:

Reference to name of tab