Android technology 20: Android initialization process, android Initialization
How is the Android system started? How is the application started. The following describes the initialization process.
1. Android system initialization
1.1Android will first start the basic Linux system, then boot the Linux kernel and start the initialization process Init
Linux Kernel ----> Init (pid = 1)
1.2 start Daemons
Start the Usb daemon and manage USB connections
Start the Android Debug Bridge daemon to manage the ADB connection
Start the debugadh Debug daemon
Start the wireless interface daemon to manage Wireless Communication
1.3 When the daemon is started, the Zygote process is started.
Create initialization Dalvik initialization instance
Classes and listeners required for loading socket requests
Create virtual machine instances to manage application processes
| Daemons
Init ----
| Zygote
1.4 next, initialize the Runtime Process
Initialize Service Manager
Register the Service Manager as the default Binder service Context Manager
1.5 Start System Service
Runtime sends a request to Zygote. Zygote creates a Dalvik Virtual Machine instance for the System Service and starts the system service. The system service starts native system services, including Audio Flinger and Surface Flinger, these local system services will be registered to the Service Manager. The system service starts the Android Management Service and registers the management service to the Service Manager.
1.6 The system load is complete, waiting for the application to start
1.7 The Activity Manager sends a Socket request to Zygote. Zygote creates a Dalvik VM process through the fork mechanism to run the application.
All application processes are subprocesses of the Zygote process. Each application processes one process and one virtual machine.
How does android initialize 20 buttons at a time and set different listening events for each button?
Public class MyView extends LinearLayout implements View. OnClickListener {
Private Context mContext;
Public MyView (Context context ){
Super (context );
// TODO Auto-generated constructor stub
MContext = context;
}
Private void make20Buttons (){
Int I = 0;
While (I <20 ){
Button button = new Button (mContext );
Button. setTag (I );
Button. setOnClickListener (this );
This. addView (button );
I ++;
}
}
@ Override
Public void onClick (View button ){
// TODO Auto-generated method stub
If (button instanceof Button ){
Switch (Integer) button. getTag ()){
Case 0:
Break;
Case 1:
Break;
Case 20:
Break;
Default:
Break;
}
}
}
}
How can I bring up a PopupWindow trigger event during initialization of the android program?
A new Handler variable is used in OnCreate to send a message. After Handler receives the message in Onmessage, it can be displayed in show; in this case, toast cannot be displayed in oncreate, and must be processed by a thread.