Android UI pattern - Background process indicator
Join the DZone community and get the full member experience.
Join For FreePattern card
Many mobile apps either handle or show data that they have to fetch over a network connection. All long running tasks should be handled in background processes to avoid making user interface non-responsive. When the application runs these tasks the user should be aware that something is happening and they should also be allowed to cancel the tasks.

A background task indicator visually shows user that something is happening in the background. With any long running blocking process the UI should also indicate how the process can be cancelled.
Consequences
- User is aware that the app is doing something on the background
- User knows how to cancel the task
Background
task indicator implementations
There are multiple ways to
implement the background task indicator.
- Action bar
- Pop-up dialog
- Notification in status bar
- Contextual indicator
- On-screen notification
Indicator in Action
Bar
Many apps use the Action Bar to provide manual refresh action
button. That is also a good place to indicate the running process when
user presses the button by changing the button into animated process
indicator.
This
approach is suitable for tasks that refresh full data of the screen or
the app.
The
same approach work on tablet UI. Plume app doesn't do it right though.
It is better to indicate the process on the refresh button than in a
separate location.
Contextual indicator
When the app is refreshing only a part of
its UI it is much better to show the indicator in the container where
the data will be loaded to.
Back button should interrupt the progress and take user
back to the previous page.

Same
approach works on tablets.
Sometimes
multiple data sets are loaded on a single screen at the same time. Some
apps show each of the data set processes separately in the context.
Notification in
status bar
Android status bar is meant to show progress of
ongoing background processes. This is good way to go when the result is
not used by the same application or if the task is likely take longer
than few seconds the user likely to exit the app. This method should
also be used when an process is launched automatically without user
interaction, for example, an automatic sync.
Indicating a long running background process with a simple toast is
a good approach when the process isn't very important and it is
unlikely that the user will wait for it to finish.
When using toast the operation will run in
background and should not block user from doing anything with the app.
This should never be used in long running blocking operations as user
won't know how to cancel it.
On-screen
notification
Some apps notify user by showing a message on the app UI. This approach is functionally very similar to using a toast but has a added benefit of being visible until the task is finished. This notification doesn't prevent users from continuing their task in the app,
Some apps notify user by showing a message on the app UI. This approach is functionally very similar to using a toast but has a added benefit of being visible until the task is finished. This notification doesn't prevent users from continuing their task in the app,

Evernote
uses the Dashboard's bottom part to indicate running background
process.
When it is possible to know how long the background process will take it is a good idea to show the user that information.
Pop-up dialog
Pop-up dialog
is an easy to implement way to indicate that user has to wait for
something to be completed before he or she can continue.

Splash screen
Some times app needs to initialise its data before anything can be shown to users. It is better to show a process indicator than just a blank screen.

Google Goggles has implemented a background process indicator that is entertaining and visually pleasing. The app displays an animation that looks like the phone is analysing the picture when in fact it is sending the image to a server and waiting for a reply.
Implementing background process indicator
Loaders API is the best way to load data on the background.
Another alternative is the AsyncTask.
Android APIs also has ready ProgressBar widget and ProgressDialog for implementing the visuals.
This article in Android developer documentation explains how to use status bar notifications.
Indicator (metadata)
mobile app
Android (robot)
Task (computing)
Published at DZone with permission of Juhani Lehtimaki, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Trending
-
Front-End: Cache Strategies You Should Know
-
How to LINQ Between Java and SQL With JPAStreamer
-
13 Impressive Ways To Improve the Developer’s Experience by Using AI
-
Tactics and Strategies on Software Development: How To Reach Successful Software [Video]
Comments