Android Architecture Components Introduction

The android app runs in android OS, and Android OS provides a lot of functions for your app to use. So master android architecture can give you a clear overview of what you are doing, what other services and components android OS can provide, and which library should you use when you need it.

1. Android Architecture.

  1. From the below picture, we can see that there are 4 layers in android. They are Linux Kernel, Android Libraries, Application Framework, Application.
    android-architecture-components
  2. Linux Kernel: Android OS is developed based on Linux, but it only uses the kernel of Linux OS, so all the java code will be translated to C++ code to run in the Linux kernel layer. The Linux kernel layer will manage all low-level physical components drivers as described in the picture.
  3. Android Libraries: This is the second layer in the android architecture. It exposes some basic android java libraries to the developer to use. In android app development, most android java libraries that we used exist in this layer. All the library is executed in the android runtime environment. And the library java byte code will be translated to C++ code by the Dalvik virtual machine and then executed in the Linux kernel. We will introduce all the basic android libraries later.
  4. Application Framework: This layer is a step further from the android libraries layer. It provides some basic android services that android apps can use. Each service reflects one android concept, so this layer makes android app development easy.
  5. Application: This is the top layer in the architecture. It is just what we developed. So now you should know what are you doing.

2. Fundamental Android Library List.

  1. As an android developer, you had better know the basic android libraries that OS provides. This can help you to find the library that you need quickly and accurately. Below we will list all the key android packages that are used frequently.
  2. android.app: This package contains all the classes ( android.app.Application, android.app.Activity, android.app.Service ) and interfaces that used to access application-level component, all other application ( you developed ) is based on it ( extends android.app.Application ).
  3. android.content: Provide object ( such as android.content.Context, android.content.Intent) which is used to transfer data between applications.
  4. android.database: Includes classes to consume data from content provider ( android.database.DataSetObserver, android.database.Cursor, android.database.CursorWindow) and also contains sqlite database management classes ( android.database.DatabaseUtils, android.database.sqlite.SQLiteDatabase, android.database.sqlite.SQLiteException ).
  5. android.graphics: Contains canvases, colors, filters, points, rectangles classes to draw low-level 2D graphics (android.graphics.Bitmap, android.graphics.Canvas, android.graphics.Color, android.graphics.Paint, android.graphics.drawable.BitmapDrawable, android.graphics.Matrix).
  6. android.hardware: Contains classes that can access hardware such as light sensors and accelerometers.
  7. android.media: Contains audio and video management classes ( android.media.MediaPlayer, android.media.AudioManager).
  8. android.net: Contains classes to implement network operations. Such as android.net.Uri, android.net.ConnectivityManager, android.net.NetworkInfo.
  9. android.os: Used to access android OS services, such as async task ( android.os.AsyncTask ) system environment ( android.os.Environment ), messages ( android.os.Message ) and data bundle ( android.os.Bundle ), etc.
  10. android.opengl: OpenGL 3D graphics rendering java classes.
  11. android.print: Provide classes which help android application to print content to configured printers.
  12. android.provider: Contains classes that used to access data from content provider such as phone contact, calendar ( android.provider.MediaStore, android.provider.Settings).
  13. android.text: Contains classes used to render and operate text in android screen ( android.text.TextUtils, android.text.TextPaint, android.text.style.ReplacementSpan, android.text.SpannableString, android.text.Html, android.text.Editable)
  14. android.util: Utility classes to perform some common tasks, such as logging ( android.util.Log ).
  15. android.view: Contains basic classes used to create android UI and response UI event ( android.view.View, android.view.ViewGroup, android.view.LayoutInflater, android.view.KeyEvent, android.view.MotionEvent ).
  16. android.webkit: Provides classes to enable web-browsing capabilities in android app ( android.webkit.WebView, android.webkit.WebSettings, android.webkit.URLUtil, android.webkit.WebViewClient, android.webkit.WebResourceRequest ).
  17. android.widget: Includes mostly used built-in basic ui components such as text view, labels, buttons, list view, checkbox, radio button, layout manager etc ( android.widget.TextView, android.widget.Button, android.widget.EditText, android.widget.ListView, android.widget.LinearLayout, android.widget.TableLayout ).

3. Application Framework.

  1. The android application framework provides the below services, these services are high-level than libraries, each service is used to control a module of android.
  2. Activity Manager: Controls android activity lifecycle and stack.
  3. Content Providers: Enable the android app to share data with each other.
  4. Location Manager: Provide location service to let the android app get device location data.
  5. Notifications Manager: Enable the android app to send notifications to the OS to display at the screen top area.
  6. Package Manager: Android app can use this service to find out other app information installed on the same device.
  7. Resource Manager: Manager to get resources defined in resource files such as string resource, color resource, and layout resource files.
  8. Telephony Manager: Provides telephony information such as subscriber and status.
  9. View System: This contains a lot of classes to manage the app user interface.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.