Android Foundation 01 and Android 01
Android basic 01SDK System images
This is the system image required when creating the simulator, that is, the CPU/ABI item needs to be selected when creating the simulator. After downloading and decompressing the package, copy the decompressed entire folder or move it to the/system-images folder in the your sdk path. If the system-images directory does not exist, create the folder first, and then open the SDK Manager, open Tools menu select Options menu to open the Android SDK Manager Setting dialog box, click the Clear Cache button, and then restart Eclipse (or Android Studio) and SDK Manager.
SDK
This is the sdk required for Android development. After downloading and unzipping the sdk, copy the decompressed entire folder or move it to the your SDK path/platforms folder, open sdk Manager, and open Tools) select Options to open the Android SDK Manager Setting dialog box, click the Clear Cache button, and then restart Eclipse (or Android Studio) and SDK Manager.
ADBAndroid debugging bridge dos window
Use the adb tool to upload the apk package to the simulator (real machine). The directory is in data \ app \
Read the androidManifest. xml configuration file (package name, permission, icon, etc.) to create a folder, and create a directory named folder under the data \ directory.
Write the Registry file data \ system \ packages. xml
Start APK
Android is a multi-user Linux system. Once an application is installed, the system assigns an independent Linux User ID to each application. When you click the application icon or navigate to the application components, the Android framework creates a virtual machine instance, starts a process, creates a main thread (UI thread), instantiates the entry component, and enters the life cycle of the component.
Linux assigns an id to each program and drives the allocation based on the user's permissions.
<package name="cn.zlpro.firstname" codePath="/data/app/cn.zlpro.firstname-2.apk"
nativeLibraryPath="/data/app-lib/cn.zlpro.firstname-2"
flags="572998" ft="14f1c6d95e0"
it="14f1c6864d2" ut="14f1c6d9780"
version="1" userId="10055">
<sigs count="1">
<cert index="3" />
</sigs>
<perms />
<signing-keyset identifier="1" />
</package>
Uninstall the apk named com.cn. zhulang
Sometimes adb cannot be restarted. We just need to disconnect and connect. The second possible reason is that the port is occupied because the adb usessocket
Connected, so we,netstat -ano
View the network status. Close the corresponding program and connect it here.
Several Methods for clicking an event:
Button btn = (Button) this. findViewById (R. id. button1 );
Btn. setOnClickListener (new OnClickListener ()
{
Public void onClick (View v)
{
Toast. makeText (Clickactivity. this, "anonymous internal class", Toast. LENGTH_SHORT );
}
});
2. Private class
Button proBtn = (Button) this. findViewById (R. id. button2 );
ProBtn. setOnClickListener (new myOnClickListener ());
}
// Implement the OnClickListener Interface
Private class myOnClickListener implements OnClickListener
{
Public void onClick (View v)
{
Toast. makeText (Clickactivity. this, "internal class", Toast. LENGTH_SHORT );
}
}
// Rewrite the onClick method. Here, V is the current loading attempt.
Public void onClick (View v)
{
Switch (v. getId ())
{
Case R. id. button1: System. out. println ("click the button ");
Break;
Case R. id. button2: System. out. println ("Click button2 ");
Default:
Break;
}
}
Public void myOnClick (View v)
{
System. out. println ("click event you set through Xml properties ");
}
Four major components: activity
The only interface that can be displayed.
Display Interface: Throughwindows.setContentView()
Display
Interaction:View
Capture events. Windows Manager
View: The Basic module of the user interface component. It is responsible for rendering graphical interfaces and event processing .,
set Visibility
Visble: visible
Layout
RelaviteLayout Layout
Set up a brick-and-mortar game,
3.View the inheritance map of Android classes