JNI:
http://blog.youkuaiyun.com/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、Services、Content providers、Broadcast receivers。
android process 五类按优先级排列:
Foreground processVisible processService 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 doesnotcreate 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 asonKeyDown()to report user actions or a lifecycle callback method) always run in the UI thread of the process.
the Andoid UI toolkit isnotthread-safe(components from theandroid.widgetandandroid.viewpackages). 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:
- Do not block the UI thread
- Do not access the Android UI toolkit from outside the UI thread
修改UI线程中控件的状态,最好的方法是用AsyncTask ;
本文详细解析JNI(Java Native Interface)在Android开发中的应用,包括内部目录结构、关键函数调用流程以及如何实现跨语言调用。同时,阐述了Android进程中Linux用户ID的分配机制、组件类型及其优先级,以及Android线程模型与UI线程操作的限制。最后,提供在工作线程中更新UI状态的最佳实践,如使用AsyncTask等方法。
363

被折叠的 条评论
为什么被折叠?



