Info

This chapter continues the introduction of the basic building blocks of an application. First, the explicit specification of threads is introduced as a method to separate tasks. Then, services and broadcast receivers are introduced. These can also benefit from threads, as shown in some recipes.The application widget, which utilizes receivers, is then cov-ered.This leads naturally to the discussion of various alerts available to the developer.

Every application by default runs a single process upon creation that contains all the tasks. To avoid hanging the user interface, time-consuming tasks, such as network downloads or computationally intensive calculations, should reside in a separate background thread. It is up to the developer to implement this properly, but then the Android operating system (OS) prioritizes the threads accordingly.

Most applications can benefit from the use of threads. If such occasions are not detected in the software design phase, they quickly display during testing because the Android system provides an alert to the user when the user interface (UI) hangs, as shown in Figure 3.1.

Character Building Thought Power

Character Building Thought Power

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.

Get My Free Ebook


Post a comment