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.
ขยาย: | Fragment |
แพ็คเกจ: | widget |
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()
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)
พารามิเตอร์ | คำอธิบาย |
---|---|
onDataChangedListener | The 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()
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)
พารามิเตอร์ | คำอธิบาย |
---|---|
onSelectionChangedListener | The 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()
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)
พารามิเตอร์ | คำอธิบาย |
---|---|
onDoneButtonClickedListener | The 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()
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)
พารามิเตอร์ | คำอธิบาย |
---|---|
onErrorListener | The 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()
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)
พารามิเตอร์ | คำอธิบาย |
---|---|
filter | The GraphObjectFilter, or null if there is none |
getSession()
Gets the Session to use for any Facebook requests this fragment will make.
public Session getSession()
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)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | The 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()
setShowPictures(boolean)
Sets whether to display pictures, if available, for displayed graph objects.
public void setShowPictures(boolean showPictures)
พารามิเตอร์ | คำอธิบาย |
---|---|
showPictures | True if pictures should be displayed, false if not |
getExtraFields()
Gets the extra fields to request for the retrieved graph objects.
public Set getExtraFields()
setExtraFields(Collection)
Sets the extra fields to request for the retrieved graph objects.
public void setExtraFields(Collection fields)
พารามิเตอร์ | คำอธิบาย |
---|---|
fields | The 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)
พารามิเตอร์ | คำอธิบาย |
---|---|
showTitleBar | True 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()
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)
พารามิเตอร์ | คำอธิบาย |
---|---|
titleText | The 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()
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)
พารามิเตอร์ | คำอธิบาย |
---|---|
doneButtonText | The 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()
loadData(boolean)
Causes the picker to load data from the service and display it to the user.
public void loadData(boolean forceReload)
พารามิเตอร์ | คำอธิบาย |
---|---|
forceReload | If 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)
พารามิเตอร์ | คำอธิบาย |
---|---|
forceReload | If 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) |
selectIds | Ids 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)
พารามิเตอร์ | คำอธิบาย |
---|---|
inState | A Bundle containing keys corresponding to properties of the PickerFragment |
SHOW_PICTURES_BUNDLE_KEY
public static final String SHOW_PICTURES_BUNDLE_KEY
EXTRA_FIELDS_BUNDLE_KEY
public static final String EXTRA_FIELDS_BUNDLE_KEY
SHOW_TITLE_BAR_BUNDLE_KEY
public static final String SHOW_TITLE_BAR_BUNDLE_KEY
TITLE_TEXT_BUNDLE_KEY
public static final String TITLE_TEXT_BUNDLE_KEY
DONE_BUTTON_TEXT_BUNDLE_KEY
public static final String DONE_BUTTON_TEXT_BUNDLE_KEY