Android Architecture Components Introduction

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

1. Android Architecture.

android architecture components

From above picture, we can see that there are four layer in android.

  1. Linux Kernel : Android OS is developed based on Linux, but it only use 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.
  2. Android Libraries : This is the second layer in android architecture. It expose some basic android java library to developer to use. In android app developing, most android java library which 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 dalvik virtual machine and then executed in the Linux kernel. We will introduce all the basic android library later.
  3. Application Framework : This layer is a step further of android libraries layer. It provide some basic android services that android app can use. Each service reflect to one android concept, so this layer make android app development easy.
  4. Application : This is the top layer in architecture. It is just what we developed. So now you should know what are you doing.
READ :   Android WebView Examples

2. Fundamental Android Library List.

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.

  1. android.app :  This package contains all the classes ( android.app.Applicationandroid.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 ).
  2. android.content : Provide object ( such as android.content.Context, android.content.Intent) which is used to transfer data between applications.
  3. 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 ).
  4. 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).
  5. android.hardware : Contains classes which can access hardware such as light sensor and accelerometer.
  6. android.media : Contains audio and video management classes ( android.media.MediaPlayer, android.media.AudioManager).
  7. android.net : Contains classes to implement network operations. Such as android.net.Uri, android.net.ConnectivityManager, android.net.NetworkInfo.
  8. android.os : Used to access android OS services, such as asynctask (android.os.AsyncTask) system environment ( android.os.Environment ) , messages ( android.os.Message ) and data bundle ( android.os.Bundle ) etc.
  9. android.opengl : OpenGL 3D graphics rendering java classes.
  10. android.print : Provide classes which help android application to print content to configured printers.
  11. android.provider : Contains classes that used to access data from content provider such as phone contact, calendar ( android.provider.MediaStore, android.provider.Settings).
  12. 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)
  13. android.util : Utility classes to perform some common tasks, such as logging (android.util.Log).
  14. 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 ).
  15. 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).
  16. 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).
READ :   Android AsyncTask Example

3. Application Framework.

Android application framework provide below services, these services is high-level than libraries, each service is used to control a module of android.

  1. Activity Manager : Controls android activity lifecycle and stack.
  2. Content Providers : Enable android app to share data with each other.
  3. Location Manager : Provide location service to let android app to get device location data.
  4. Notifications Manager : Enable android app to send notifications to the OS to display at the screen top area.
  5. Package Manager : Android app can use this service to find out other app information installed in same device.
  6. Resource Manager : Manager to get resources defined in resource files such as string resource, color resource and layout resource files.
  7. Telephony Manager : Provides telephony information such as subscriber and status.
  8. View System : Contains a lot of classes to manage app user interface.
(Visited 378 times, 1 visits today)

Leave a Reply

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.