Portal Feature User Groups Sample
The purpose of this sample is to show how to create a portal, get groups from the portal. From each group get the items. Using the item construct a webmap and add it to the mapview.
Sample Design
The sample consists of three activity classes. The FeaturedGroupsList fetches the groups from the portal, when a group is chosen in the listview it passes the groupid via the intent to the ItemListGeneralList. This class fetches the item for the group chosen by the user. When the user chooses an item in the ItemListGeneralList class, the MapActivity is called which is used to display the webmap in the mapview.
In the FeaturedGroupList class the portal is created using the constructor which takes credentials, portal url.
The portalInfo object can be obtained from the portal object using fetchPortalInfo() method. From the portalInfo.getFeaturedGroupsQueries, returns a list of queries.
At this point the group for each of query will be fetched from the portal. Each time the callback returns the listview adapter is updated. Once a group is selected the next activity is launched where the items for that group are fetched from the portal and displayed in the listview of MyGroup objects, MyGroup is an internal class that contains the group name and thumbnail. The listview adapter is updated with the group in the uithread. Once a group is selected the next activity is launched where the items for that group are fetched from the portal and displayed in the listview.
Once an item is chosen from the item list, a webmap is constructed. This is done in the mapviewactivity. The webmap is created using the item chosen in the item list, when the callback returns successfully the webmap is added to the mapview. In order to add the webmap a uithread must be used from the main activity.
Using the Sample
- Install the APK on your device
- The sample launches the progress dialog
- When the task is completed, the progress dialog goes away
- Select a group displayed in the list view
- Select an item displayed in the list view
- The corresponding map will be displayed on your device