Introduction to Android Development

Source: Internet
Author: User

First, communication technology

1, 1G: Analog format can only be voice calls.
2, 2g:gsm, CDMA send and receive SMS and mail.
3, 2.5G : GPRS, EDGE, access to WAP network data. (Pictures, wallpapers, text messages).
4, 3G:WCDMA (Unicom), CDMA2000 (Telecom), TD-SCDMA (mobile), tweet, view high-definition pictures, small movies.
5, 3.5G : HSDPA, hsdpa+.
6, 4g:td-lte , download speed: 50mb/s = 6mb/s, upload speed: 10mb/s = 1.2mb/s.

Second, the Android system architecture level


1. Application Layer
The tier provides core application packages such as e-mail, text messages, calendars, maps, browser and contact management. At the same time, developers can use the Java language to design and write their own applications, which are equal and friendly with those core applications.
2. Application Framework Layer
This layer is the basis for Android app development, and most of the time developers are dealing with her. The application framework layer includes the Activity Manager, window Manager, content provider, view system, Package Manager, Phone manager, resource manager, Location manager, Notification Manager, and XMPP Services 10 sections. On the Android platform, developers have full access to the API framework used by the core application. Also, any application can publish its own module of functionality, while other applications can use these published function modules. Based on this reuse mechanism, users can easily replace the various application components of the platform itself.
3. System Library and Android runtime
The system library consists of nine subsystems, layer management, Media Library, SQLite, Openglestate, FreeType, WebKit, SGL, SSL, and libc. The Android runtime includes both the core library and the Dalvik virtual machine, which are compatible with the function functions that most Java languages need to invoke, and the core libraries of Android, such as Android.os, Android.net, Android.media, and so on. The latter is a register-based Java Virtual machine, Dalvik virtual machine is to complete the life cycle management, stack management, thread management, security and exception management, garbage collection and other important functions.
4. Linux kernel
Android Core system services rely on Linux2.6 cores such as security, memory management, process management, network protocol stacks, and drive models. The Linux kernel is also an abstraction layer for hardware and software stacks. Drivers: Display drivers, camera drivers, keyboard drivers, wifi drivers, audio drivers, flash memory drivers, Binder (IPC) drivers, power management, and more.
Android Hierarchy Summary:
1, the Android system architecture uses the idea of layered architecture, the structure is clear, hierarchical, work together.
2, Android system architecture not only from the macro understanding of the Android system, but also to our learning and practice pointed out the direction. If you're working on Android apps, you should study Android's application framework and application layer, and if you're working on Android, you should study Android's system library and Android runtime, and if you're working on Android-driven development, That should study Android's Linux kernel. In short, find the right entry point, practice the truth.

Iii. DVM (Dalvik VM) vs. JVM

1, the two virtual machine execution files are different, the DVM execution file is. DEX,JVM's execution file is. jar.

DVM Compilation process:. Java--Javac---.class--> Dex-->.odex

JVM compilation process:. Java--Javac--Class-->.jar

2. The schema differs between them, and the DVM is based on a register, and the JVM is stack-based.

3. dex files and class byte codes such as:


Iv. use of the ADB command

ADB devices List of all devices
ADB start-server open ADB service
ADB kill-server close ADB service
ADB logcat View Log
ADB shell mounts to Linux space
ADB Install < applications (plus extensions) > Install Applications
Adb–s < emulator name > install < application (plus extension) > Installing apps to the specified emulator
ADB Uninstall < package name >
adb pull <remote> <local> download
ADB push <local> <remote> upload
EMULATOR–AVD < simulator name >

V. Structure of Android Project

SRC: Storing Java code
Gen: Storing automatically generated files. R.java Store the ID of the corresponding resource under the Res folder
Project.Properties: Specifies the version of the development kit used by the current project
Libs: The jar package that the current project relies on.
Assets: The media files required to place some programs.
Bin: The compilation Directory of the project. Store some temporary files generated at compile time and the. apk file for the current project.
Res (Resources): Resource file.
Drawable: The picture used to store the program.
Layout: Store the android layouts file.
Menu: Stores the layout of the Android optionsmenu menu.
Values (the data required by the application. IDs are generated in the R file)
Strings.xml holds Android strings.
Dimens.xml the size used to store the screen fit.
Style.xml stores the styles displayed under Android.
VALUES-SW600DP values for 7-inch plates
Values-sw720dp-land values for 10-inch plates
VALUES-V11 Specifies the style that is displayed for phones above the 3.0 version.
VALUES-V14 Specifies the style that is displayed for phones above the 4.0 version.
The portal file for the AndroidManifest.xml:android application. The components inside Android are declared. and related configuration information.
Proguard-project.txt: Encrypts the current program used.

Six, packaging process: Packaging installation process (Run as Android application):

1. Build the APK file.
(1) Generate a. dex file.
(2) The generation RESOURCES.ARSC of the Resource Index table.
(3) Prepare the file for non-compilation.
(4) The manifest file Androidmenifest.xml file is converted to binary.
(5) Use Debug.keystore to package and sign the entire application.
2. Load the APK file into the emulator.
Load the apk file into/data/local/tmp/xxx.apk
3. Install the application.
(1) Put/data/local/tmp/xxx.apk file, cut/data/app/package name -1.apk
(2) Under the/data/data/folder, create a folder with the package name to store the data for the current program.
(3) Add a separate record in the Packages.xml and packages.list files.

七、二个 Demo

1, the implementation of the dialer

Specify the simulator number (such as 5554, 5556) on the two simulator tests.

                1. Take out the number in the input box EditText Etnumber = (EditText) Findviewbyid (r.id.number);//Input Box object String # = Etnumber.gettext (). ToString ( )///number to be dialed//2. Make a call according to the number intent intent = new intent ();//Create an Intent intent.setaction (intent.action_call);//Specify its action to call Intent.setdata ( Uri.parse ("Tel:" + number);//Specify the numbers to be dialed startactivity (intent);//Perform this action

2, SMS transmitter (background secretly texting)

                Opens a child thread. while (true) loop sends SMS new Thread (new Runnable () {@Overridepublic void run () {while (true) {//Loop SMS//Thread.Sleep (1000); Systemclock.sleep (5000); Smsmanager Smsmanager = Smsmanager.getdefault (); SMS Manager smsmanager.sendtextmessage ("5556",//Recipient's number null,//SMS Center number "Aadsfds", NULL,//if sent successfully, callback this broadcast, notify us. null);//When the other party receives Successful, callback this broadcast.}}). Start ();

Viii. four ways to achieve click events

1. Register the OnClick property event through the layout file.

        
2. Use the inner class of the Click event

                Button Btncall = (button) Findviewbyid (R.id.btn_call); Btncall.setonclicklistener (new Onclicklistener () {@ overridepublic void OnClick (View v) {System.out.println ("Perform a click event! ");}});
3. Use the Click event class

                Button Btncall = (button) Findviewbyid (R.id.btn_call); Btncall.setonclicklistener (new Myonclicklistener ());// The Myonclicklistener class implements the Onclicklistener interface
4. Implement Onclicklistener interface in activity

public class MainUI4 extends Activity implements Onclicklistener {/** * callback this method when the interface has just been created */@Overrideprotected void OnCreate (B Undle savedinstancestate) {super.oncreate (savedinstancestate);//must execute this code. Performs the initialization of the parent class. Setcontentview (R.layout.main )///Set the layout of the current interface Button Btncall = (button) Findviewbyid (R.id.btn_call); Btncall.setonclicklistener (this);//Register Click event}@ overridepublic void OnClick (View v) {System.out.println ("Perform a click event! ");}}
In the actual development of the general use of the 2nd to 4th way, the first method is seldom used, because this way makes the interface and the code between the coupling.


Introduction to Android Development

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.