Before working with the Item Selector API, you should learn about its components. You’ll work with these components as you leverage the API in your apps:
Selection views: These are the framework’s key components. They show entities of particular types from different sources. For example, an Item Selector configured to show images might show selection views from Documents and Media, a third-party image provider, or a drag-and-drop UI.
Return Type: A class that represents the type of information returned from the entities selected by the users. For example, if users select images and you want to return the selected image’s URL, then you need a URL return type class. Each return type class must implement the
ItemSelectorReturnTypeinterface. Such classes are named after the data they return and suffixed with
ItemSelectorReturnType. For example, the URL return type class is
Criterion: A class that represents the entity selected by the users. For example, if users select images then you need an image criterion class. Each criterion class must implement the
ItemSelectorCriterioninterface. Criterion classes are named for the entity they represent and suffixed with
ItemSelectorCriterion. For example, the criterion class for images is
Criterion Handler: A class that gets the appropriate selection view. Each criterion requires a criterion handler. Criterion handler classes extend the
BaseItemSelectorCriterionHandlerclass with the criterion’s entity as a type argument. Criterion handler classes are named after the criterion’s entity and suffixed by
ItemSelectorCriterionHandler. For example, the image criterion handler class is
ImageItemSelectorCriterionHandler. It extends
This diagram shows how these components interact to form a working API.