Routing & Navigation

Search

Portal Organizational Info

The purpose of this sample is to show how to create UserCredentials and a Portal object, and then use these to log in to a portal and fetch information about the portal and the organization.

Features

Portal API

User Credentials

Simple Async Task

Fetch Organization Thumbnail

Sample Design

This sample has one activity, OrganizationInfoActivity, which executes an AsyncTask to do all the work. A private class OrgInfoAsyncTask extends AsyncTask and overrides the following methods:

The preExecute() method displays a progress dialog on the UI thread.

The doInBackground() method, which runs on a background thread, logs in to the server and fetches information about the portal and organization. It also checks if there is an organization thumbnail and if so fetches it.

The onPostExecute() method then displays the information on the UI thread.

A Portal object is created using the constructor which takes portal URL and credentials. The fetchPortalInfo() method is used to log in to the portal. This returns a PortalInfo object that contains most of the portal and organization info. However, the organization thumbnail (if any) must be fetched by calling fetchOrganizationThumbnail(). The thumbnail data is converted to a BitmapDrawable for display.