PickerFragment
This class is no longer available in the most recent version of the SDK.

Provides functionality common to SDK UI elements that allow the user to pick one or more graph objects (e.g., places, friends) from a list of possibilities. The UI is exposed as a Fragment to allow to it to be included in an Activity along with other Fragments. The Fragments can be configured by passing parameters as part of their Intent bundle, or (for certain properties) by specifying attributes in their XML layout files.

PickerFragments support callbacks that will be called in the event of an error, when the underlying data has been changed, or when the set of selected graph objects changes.

Extends:Fragment
Package:widget
Instance Methods
getOnDataChangedListener()

Gets the current OnDataChangedListener for this fragment, which will be called whenever the underlying data being displaying in the picker has changed.

public OnDataChangedListener getOnDataChangedListener()
Returns
The OnDataChangedListener, or null if there is none
setOnDataChangedListener(OnDataChangedListener)

Sets the current OnDataChangedListener for this fragment, which will be called whenever the underlying data being displaying in the picker has changed.

public void setOnDataChangedListener(OnDataChangedListener onDataChangedListener)
ParameterDescription
onDataChangedListenerThe OnDataChangedListener, or null if there is none
getOnSelectionChangedListener()

Gets the current OnSelectionChangedListener for this fragment, which will be called whenever the user selects or unselects a graph object in the list.

public OnSelectionChangedListener getOnSelectionChangedListener()
Returns
The OnSelectionChangedListener, or null if there is none
setOnSelectionChangedListener(OnSelectionChangedListener)

Sets the current OnSelectionChangedListener for this fragment, which will be called whenever the user selects or unselects a graph object in the list.

public void setOnSelectionChangedListener(OnSelectionChangedListener onSelectionChangedListener)
ParameterDescription
onSelectionChangedListenerThe OnSelectionChangedListener, or null if there is none
getOnDoneButtonClickedListener()

Gets the current OnDoneButtonClickedListener for this fragment, which will be called when the user clicks the Done button.

public OnDoneButtonClickedListener getOnDoneButtonClickedListener()
Returns
The OnDoneButtonClickedListener, or null if there is none
setOnDoneButtonClickedListener(OnDoneButtonClickedListener)

Sets the current OnDoneButtonClickedListener for this fragment, which will be called when the user clicks the Done button. This will only be possible if the title bar is being shown in this fragment.

public void setOnDoneButtonClickedListener(OnDoneButtonClickedListener onDoneButtonClickedListener)
ParameterDescription
onDoneButtonClickedListenerThe OnDoneButtonClickedListener, or null if there is none
getOnErrorListener()

Gets the current OnErrorListener for this fragment, which will be called in the event of network or other errors encountered while populating the graph objects in the list.

public OnErrorListener getOnErrorListener()
Returns
The OnErrorListener, or null if there is none
setOnErrorListener(OnErrorListener)

Sets the current OnErrorListener for this fragment, which will be called in the event of network or other errors encountered while populating the graph objects in the list.

public void setOnErrorListener(OnErrorListener onErrorListener)
ParameterDescription
onErrorListenerThe OnErrorListener, or null if there is none
getFilter()

Gets the current filter for this fragment, which will be called for each graph object returned from the service to determine if it should be displayed in the list. If no filter is specified, all retrieved graph objects will be displayed.

public GraphObjectFilter getFilter()
Returns
The GraphObjectFilter, or null if there is none
setFilter(GraphObjectFilter)

Sets the current filter for this fragment, which will be called for each graph object returned from the service to determine if it should be displayed in the list. If no filter is specified, all retrieved graph objects will be displayed.

public void setFilter(GraphObjectFilter filter)
ParameterDescription
filterThe GraphObjectFilter, or null if there is none
getSession()

Gets the Session to use for any Facebook requests this fragment will make.

public Session getSession()
Returns
The Session that will be used for any Facebook requests, or null if there is none
setSession(Session)

Sets the Session to use for any Facebook requests this fragment will make. If the parameter is null, the fragment will use the current active session, if any.

public void setSession(Session session)
ParameterDescription
sessionThe Session to use for Facebook requests, or null to use the active session
getShowPictures()

Gets whether to display pictures, if available, for displayed graph objects.

public boolean getShowPictures()
Returns
True if pictures should be displayed, false if not
setShowPictures(boolean)

Sets whether to display pictures, if available, for displayed graph objects.

public void setShowPictures(boolean showPictures)
ParameterDescription
showPicturesTrue if pictures should be displayed, false if not
getExtraFields()

Gets the extra fields to request for the retrieved graph objects.

public Set getExtraFields()
Returns
The extra fields to request
setExtraFields(Collection)

Sets the extra fields to request for the retrieved graph objects.

public void setExtraFields(Collection fields)
ParameterDescription
fieldsThe extra fields to request
setShowTitleBar(boolean)

Sets whether to show a title bar with a Done button. This must be called prior to the Fragment going through its creation lifecycle to have an effect.

public void setShowTitleBar(boolean showTitleBar)
ParameterDescription
showTitleBarTrue if a title bar should be displayed, false if not
getShowTitleBar()

Gets whether to show a title bar with a Done button. The default is true.

public boolean getShowTitleBar()
Returns
True if a title bar will be shown, false if not.
setTitleText(String)

Sets the text to show in the title bar, if a title bar is to be shown. This must be called prior to the Fragment going through its creation lifecycle to have an effect, or the default will be used.

public void setTitleText(String titleText)
ParameterDescription
titleTextThe text to show in the title bar
getTitleText()

Gets the text to show in the title bar, if a title bar is to be shown.

public String getTitleText()
Returns
The text to show in the title bar
setDoneButtonText(String)

Sets the text to show in the Done button, if a title bar is to be shown. This must be called prior to the Fragment going through its creation lifecycle to have an effect, or the default will be used.

public void setDoneButtonText(String doneButtonText)
ParameterDescription
doneButtonTextThe text to show in the Done button
getDoneButtonText()

Gets the text to show in the Done button, if a title bar is to be shown.

public String getDoneButtonText()
Returns
The text to show in the Done button
loadData(boolean)

Causes the picker to load data from the service and display it to the user.

public void loadData(boolean forceReload)
ParameterDescription
forceReloadIf true, data will be loaded even if there is already data being displayed (or loading); if false, data will not be re-loaded if it is already displayed (or loading)
loadData(boolean, Set)

Causes the picker to load data from the service and display it to the user.

public void loadData(boolean forceReload, Set selectIds)
ParameterDescription
forceReloadIf true, data will be loaded even if there is already data being displayed (or loading); if false, data will not be re-loaded if it is already displayed (or loading)
selectIdsIds to select, if they are present in the loaded data
setSettingsFromBundle(Bundle)

Updates the properties of the PickerFragment based on the contents of the supplied Bundle; calling Activities may use this to pass additional configuration information to the PickerFragment beyond what is specified in its XML layout.

public void setSettingsFromBundle(Bundle inState)
ParameterDescription
inStateA Bundle containing keys corresponding to properties of the PickerFragment
Constants
SHOW_PICTURES_BUNDLE_KEY
The key for a boolean parameter in the fragment's Intent bundle to indicate whether the picker should show pictures (if available) for the graph objects.
public static final String SHOW_PICTURES_BUNDLE_KEY
EXTRA_FIELDS_BUNDLE_KEY
The key for a String parameter in the fragment's Intent bundle to indicate which extra fields beyond the default fields should be retrieved for any graph objects in the results.
public static final String EXTRA_FIELDS_BUNDLE_KEY
SHOW_TITLE_BAR_BUNDLE_KEY
The key for a boolean parameter in the fragment's Intent bundle to indicate whether the picker should display a title bar with a Done button.
public static final String SHOW_TITLE_BAR_BUNDLE_KEY
TITLE_TEXT_BUNDLE_KEY
The key for a String parameter in the fragment's Intent bundle to indicate the text to display in the title bar.
public static final String TITLE_TEXT_BUNDLE_KEY
DONE_BUTTON_TEXT_BUNDLE_KEY
The key for a String parameter in the fragment's Intent bundle to indicate the text to display in the Done btuton.
public static final String DONE_BUTTON_TEXT_BUNDLE_KEY