HDML applications are structured around activities. Activities correspond to tasks the user wants to carry out. Each activity consists of one or more steps.
An HDML service can provide multiple activities to its users. For example, a mail service might provide activities such as "Create a New Message" and "View Mail Inbox". The "Create a New Message" activity might include steps to enter an e-mail address, enter a subject, and enter the message body.
Figure 1-6 provides a conceptual overview of services and activities.
FIGURE 1-6. Services and activities
Each step in an activity typically corresponds to a single HDML card. For example, a "Get a stock quote" activity might include one card to enter the ticker symbol and another card to view the quote.
The HDML for an activity uses GO tasks (TASK=GO options) to navigate from one card to the next. You can implement an activity with a single deck (as shown in Figure 1-5) or multiple decks (as shown in Figure 1-7).
FIGURE 1-7. Activity spanning multiple decks
Just as a task can include subtasks, an activity can include nested "subactivities." For example, suppose you want to implement a "View Message" activity of an email service. One subtask of the "View Message" task might be to delete the message; another might be to forward the message. To implement the "View Message" activity, you create HDML activities to match these tasks. You create a main activity, "View Message," and nested subactivities, "Delete Message" and "Forward Message." Figure 1-8 depicts this implementation.
You can nest activities multiple levels deep. For example, the "View Message" activity described above could be nested within another activity, such as a "View Inbox" activity.
To spawn a nested activity in HDML, you specify a GOSUB task to go to the first card in the activity. For example, to implement the "View Inbox" activity described above, you would specify GOSUB tasks to navigate to the first cards of the "Read Message" and "Forward Message" activities.
As the user navigates into nested activities, the phone preserves the state of each activity. The state includes attributes such as the activity's variables and its card history stack.
HDML allows you to specify actions that CANCEL the current activity. Canceling an activity returns the user to the activity that originally invoked the current activity.