Android Foundation 01 and Android 01

Source: Internet
Author: User
Tags android sdk manager

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
  • abd devicesView and start the Android device. Then
  • adb kill -serverDisconnect abd
  • adb install xxxx.apkInstall apk
  • adb uninstall com.cn.zhulang
  • Adb-s Add the device name and port numberAdb settings for multiple Simulators
  • adb sellEnter shell command mode

    Install APK

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 usessocketConnected, so we,netstat -anoView 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:ViewCapture events. Windows Manager

View: The Basic module of the user interface component. It is responsible for rendering graphical interfaces and event processing .,

set VisibilityVisble: visible

Layout

RelaviteLayout Layout

Set up a brick-and-mortar game,

3.View the inheritance map of Android classes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.