Portal Organizational Info Sample

Complexity: Beginner Data Requirement: ArcGIS Tutorial Data for Desktop

The purpose of this sample is to show how to create a portal, and thereby use portal info to get information about the organization. This is equivalent to a hello world sample for the portal.

Sample Design

This sample has a layout to which information obtained from the portal info object is displayed. The portal is created using the constructor which takes credentials and portal url. When the portal is created successfully the callback returns with a portal object. If the callback is unsuccessful the error message is thrown. Once the callback returns, the portalInfo object can be obtained from the portal object using getPortalInfo() method. In order to display the text information in the layout views, use the UI thread in the activity and display the information. The portalInfo also has the thumbnail used for a organization and portal. The thumbnail must be fetched using the PortalListener with byte[] parameter. On the portalInfo object, use the fetchOrg/PortalThumbnail method, pass it the PortalListner<byte[]>. When the callback returns with the byte array, convert the byte array to a bitmap and display it in the imageview defined in the layout. Since the callback listener thread is separate from the activity ui thread, spawn a ui thread from the main activity and add the bitmap to the imageview.

For convenience a progress bar has been added, it stops spinning when the callback from the thumbnail is completed.

Using the Sample

Steps:
  1. Install the APK on your device
  2. The sample launches the progress bar
  3. When the task is completed, the progress dialog goes away and the UI is populated with the information from the Portal.
5/31/2012