• Application Internals
  • Application Life Cycle
  • Bibliography
  • Android Operating System




    Download 0.67 Mb.
    bet10/10
    Sana22.12.2019
    Hajmi0.67 Mb.
    #4574
    1   2   3   4   5   6   7   8   9   10

    Applications and Tasks


    Android applications are made up of processes and their included threads. Tasks are a series of activities of possibly multiple applications. A task is basically a history of a user’s actions. E.g. When a user reads their mail and opens a link which uses the browser application. In this case, the task is made up of two applications (mail and browser) and many activities. The importance of the task concept is that it allows users to navigate backwards like popping elements of a stack.
      1. Application Internals


    The structure of an Android applications is based on four different components which are Activity, Service, Broadcast Receiver and Content Provider. An application doesn’t necessarily have all these components but it should at least have an Activity in order to present a graphical user interface.

    Services and broadcast receivers allow applications to perform jobs in the background. Services usually run for a long time but broadcast receivers can be triggered by events and run for a short time.


      1. Application Life Cycle


    Figure 2: Activity Life Cycle

    An activity is a single screen of an application. It contains visual elements that allow user interaction. An application caontains many activities. The state of an android applications processes is determined by the state of the application’s components, such as its activities. As the application components alter their states the underlying type of the process is changed. All activities are subclasses from android.app.Activity and their life cycle is controlled by the On…() functions.

    As an application starts, the following functions are called sequentially OnCreate(), OnStart() and OnResume(). OnCreate() is called only one in the lifetime of a process but OnStart() and OnResume() are called more often. If an activity loses focus then the OnPause() function is called. If the activity is no longer visible then the OnStop() function is called. Before deleting the activity OnDestroy() function is called which end the activity lifetime



    The following describes the functions in detail:

    • OnCreate(): The initial functions that initialized the activity.



    • OnStart(): The process type changes to visible and the activity is about to become visible to the user



    • OnResume(): The process is is set to foreground. The application gets focus and can get user input.



    • OnPause(): When the device goes to sleep or the application loses focus the process is set to visible. From here, the process may be resumed or stopped



    • OnStop(): The activity is not visible and the process type is set to background and the application can be killed at any time



    • OnDestroy(): This method is called right before the system kills the process and the application deletes the activity


    Bibliography





    Download 0.67 Mb.
    1   2   3   4   5   6   7   8   9   10




    Download 0.67 Mb.