Portal Feature User Groups Sample

Complexity: Beginner Data Requirement: ArcGIS Tutorial Data for Desktop

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

Steps:
  1. Install the APK on your device
  2. The sample launches the progress dialog
  3. When the task is completed, the progress dialog goes away
  4. Select a group displayed in the list view
  5. Select an item displayed in the list view
  6. The corresponding map will be displayed on your device
1/24/2013