Framework 学习笔记

来源:互联网 发布:新天龙八部挂机软件 编辑:程序博客网 时间:2024/05/21 17:50

JNI:

http://blog.csdn.net/droidpioneer/article/details/6787571

其中的目录:

internal目录:\frameworks\base\core\java\com\android\internal\os
RegFNIRec gRegJNI[]数组对应的函数在:\frameworks\base\core\jni
jniRegisterNativeMethods函数在:\dalvik\libnativehelper\JNIHelp.c中调用RegisterNatives 在\dalvik\vm\Jni.c中

android进程:

 the system assigns each application a unique Linux user ID。每个应用程序有一个Linux user ID

Each process has its own virtual machine (VM), so an application's code runs in isolation from other applications.

Android starts the process when any of the application's components need to be executed

android component:

Each component is a different point through which the system can enter your application。they areActivities、ServicesContent providersBroadcast receivers。

android process 五类按优先级排列:

Foreground process  Visible process  Service process  Background process Empty process

android线程:

When an application is launched, the system creates a thread of execution for the application, called "main.",alse called UI thread.The system does not create a separate thread for each instance of a component(android component). All components that run in the same process are instantiated in the UI thread, and system calls to each component are dispatched from that thread.Consequently, methods that respond to system callbacks (such as onKeyDown() to report user actions or a lifecycle callback method) always run in the UI thread of the process.

 the Andoid UI toolkit is not thread-safe (components from the android.widget and android.view packages). So, you must not manipulate your UI from a worker thread—you must do all manipulation to your user interface from the UI thread. Thus, there are simply two rules to Android's single thread model:

  1. Do not block the UI thread
  2. Do not access the Android UI toolkit from outside the UI thread
在工作线程中可以用:

  • Activity.runOnUiThread(Runnable)
  • View.post(Runnable)
  • View.postDelayed(Runnable, long)
  • AsyncTask
修改UI线程中控件的状态,最好的方法是用AsyncTask


原创粉丝点击