Multitasking

As previously noted, when an activity has been launched, the user can go to Home and launch a second activity without destroying the first activity. This scenario demonstrates launching the Maps application.

• State 1 - The user launches the View Map activity and searches for a map location. Let's say the network is slow, so the map is taking an unusually long taking time to draw.

• State 2 - The user wants to do something else while they're waiting, so they press HOME, which does not interrupt the map's network connection and allows the map to continue loading in the background.

Note that when you write an activity, you can make it stop or continue running when it is moved to the background (see onStop() in Activity Lifecycle). For activities that download data from the network, it's recommended to let them continue downloading so the user can multi-task.

• State 3 - The map activity is now running in the background, with Home in the foreground. The user then launches the Calendar activity, which launches into the foreground, taking user focus, where they view today's calendar (as indicated by the heavy outline). . Stale 1 , State 2 . Stale 3

(foreground)

(foreground)

View Map

User starts Calendar

Was this article helpful?

0 0

Post a comment