1th Chapter-Start your first line of Android code

Source: Internet
Author: User

Android System Architecture

1.Linux core layer (based on Linux2.6)

2. System run-level (through some C + + libraries to provide the main feature support for Android system, and have a own Dalvik virtual machine instance)

3. Application framework layer (a number of core applications that provide a variety of api,android comes with these APIs, and developers can build their own applications by using these APIs)

4. Application layer (the application on the phone belongs to this layer)



Android App Development features

1. Four components

Activity: Everything you can see is in the activity.

Service: User exits, activity continues

Broadcast receivers (broadcast Reciver): such as telephones and text messages

Content provider (ContentProvider): Sharing data among different applications

2. Rich system controls

There are systematic and customized

3.SQLite Database

Lightweight, fast-computing embedded relational database

4. Location targeting

Android phones have built-in GPS

5. Powerful Multimedia

Music, video, etc.

6. Sensor

Speed sensor, direction sensor.


Build the Environment

Tools: Androidsdk, Eclipse, ADT.

Setting up the environment: a lot of information on the Internet, no longer detailed here


Create your first Android project

The creation process is slightly.

Analysis Package Structure:


1.SRC: Where Java code is placed

2.gen: Content is automatically generated, there is a R.java file, do not manually modify

3.assets: Store Some files packaged with the program, use WebView to load the local Web page function, all the pages related files are stored in this directory.

4.bin: Contains some files that are generated automatically at compile time. There will be seen helloworld.apk, directly installed to the phone can.

5.libs: Third-party jar packages are placed here.

6.res: The picture is placed in the drawable directory, the string is placed in the values directory, and the layout is placed in the layouts directory. The contents of the R.java file are also automatically generated based on the files in this directory.

7.androidmainfest.xml: The four components are declared here, as well as adding permissions to re-establish the version.

8.project.properties: Specifies the version of the SDK that is used when compiling the program through a single line of code.

Androidmainfest.xml



Mastering the use of log tools

1. Add Logcat:window→show view→other.

2. How to use:

LOG.V (): Print the most trivial, least meaningful log information, corresponding to the verbose level.

LOG.D (): Print Some debugging information, Debug.

LOG.I (): Print What you want to see, info.

LOG.W (): Print warning message, warn.

LOG.E (): Error message printed.





1th Chapter-Start your first line of Android code

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.