Matthew
Matthew

Reputation: 44919

Intuitively Understanding Android Tasks

Tasks and Back Stack is the definitive resource for understanding the mechanism involving tasks and their interaction with the Back button. In an early paragraph:

A task is a collection of activities that users interact with when performing a certain job. The activities are arranged in a stack (the "back stack"), in the order in which each activity is opened.

Tasks are then explained in terms of the home screen and how it launches processes. This makes sense. I'm curious, however: What should determine the use of multiple tasks in "user" applications?

I'm interested in a intuitive understanding or heuristic guiding task usage rather than simply trying to achieve specific orderings of activities on the back stack.

Upvotes: 4

Views: 319

Answers (2)

erichamion
erichamion

Reputation: 4527

A task is a group of components that work coherently together to fulfill a purpose for the user (not necessarily a very specific purpose, but a purpose nonetheless). It's what the user sees as an application.

A music player exists to allow the user to manage and play songs. It may include various activities that display album/artist/song metadata, control playback, organize playlists, etc. It may also include services that implement the playback and that watch for new songs. The user doesn't know what an activity and a service are; he or she only knows that this series of screens lets him or her manage and play songs.

The activities in a task don't need to belong to the same 'application' from a development standpoint. If the music player task allows users to link an image to a song, then it might launch an image gallery activity or the camera activity. Since the new activity is still working toward the purpose of managing songs, it's still part of the same task.

On the other hand, if the user completely breaks out of the task's purpose, it might be time to start a different task. For example, if you launch a web browser to view the artist's website, the user is now doing something different. The user probably doesn't associate web browsing with managing and playing songs, so this should probably be a different task.

Upvotes: 3

Heiko Rupp
Heiko Rupp

Reputation: 30934

I think a task in that given context is sort of a workflow. Take email. Writing a new email may consist of first filling in recipients and then in the next activity selecting recipients and clicking on send finally sends the email off. Another task could be selecting multiple emails and then deleting all in one go.

In practice what you often find is an AsyncTask which is basically doing work in background which otherwise would block the UI thread and make the app non-responsive.

Upvotes: -1

Related Questions