Day 1, androidday
Day 1, getting started with Piggy's Android
Android background and development environment construction
------ Reprinted with the source: coder-pig
This section introduces:
With the development of social economy, mobile internet is becoming increasingly popular, and mobile APP development is particularly popular,
As a graduate IT plug-in, you need to take a look at IT. The current mainstream mobile phone system
IOS (Apple), Android (Android), and WinPhone (windows); WindPhone seems to have no upward momentum;
So the mainstream is the first two; As a diaosi student dog, can not afford a Mac, only a dual-core broken computer;
I can only engage in android... but it's just a joke. There's not much comparison between the two!
This series records some of the things that bloggers learned from Android and problems encountered;
It can be used as a learning reference or tutorial. If there is anything in the text that is not well written and there are any good suggestions;
Thank you!
Body:
This chapter's learning roadmap:
Learning route analysis:
① Understanding of background knowledge about Android and the Platform Architecture of Android
② Build an android development environment and use one of Eclipse and android sudio.
③ Be familiar with the APP development process of the corresponding IDE
④ Understanding of some terms
⑤ Some android process details
The Birth and Development of Android:
Android was created by Andy Rubin and later acquired by Google. The earliest version was android 1.1,
Now the latest version is Android L, which we often call Android 5.0. The names of the systems are all named after snacks.
Such as 4.4 KitKat)
Android features and platform structure: system features:
1. Application Framework SupportReuse and replacement of components(The app follows the framework conventions when it is released. Other apps can also use this module)
2.DalvikVirtual Machine: optimized for mobile devices
3. integrated browser: Open-SourceWebKitEngine
4.SQLiteStructured Data Storage
5. Optimized graphics library, multimedia support, GSM telephone technology, Bluetooth, etc.
6. UseSoftware StackMethod Construction
Android platform structure:
Simple Analysis of the framework:
① The application and application framework use the Java language.
② Android runtime: Android core library + Dalvik Virtual Machine
Each app runs independently in a single Dalvik Virtual Machine (each app processes a Dalvik)
③ Running process:
④ Features of the Dalvik Virtual Machine: high CPU computing speed and a large amount of memory space are not required;
The proprietary. dex file is implemented based on registers and relies on the core functions of linux.
Build a development environment:
2. select one of them at will! Go to the portal to learn how to create your own app
① Eclpise + ADT + SDK:Portal
② Android Studio:Portal
Familiar with ide app development process
Analysis of related terms:
Dalvik: Android-specific virtual machines, unlike JVM, Dalvik virtual machines are very suitable for use on mobile terminals!
AVD"(Android virtual machine): An android virtual device is an android simulator.
ADT(Android development tools) android development tools
SDK(Software development kittings software development kit, zhuanzhuo system, platform development and other tools, such as adb.exe)
DDMS(Dalvik debug monitor service) Android debugging tool
Adb: Android debugging Bridge, which has many functions under the platform-tools directory of the sdk. It will be introduced later.
DX Tool: Convert. class to. dex File
AAPT(Android asset packing tool), android resource packaging tool,
R. java File: The aapt tool automatically generates resources based on the resource files in the App. It can be understood as a resource dictionary.
AndroidManifest. xml:App package name + component Declaration + minimum program compatible version + required permissions and other program configuration files
* Miscellaneous
① Adb related commands:
Ps: the following commands need to be entered in the command line, and you need to go to platform-tools under the sdk directory
Of course, you can also configure the PATH so that you can directly use the following adb command.
② Android APP package and installation process:
③ Install the android app software:
For more information about how to develop a complete and detailed Android applet source code, see
Media Player source code Audio. java
Package org. example. audio;
Import android. app. Activity;
Import android. media. MediaPlayer;
Import android. OS. Bundle;
Import android. view. KeyEvent;
Public class Audio extends Activity {
Private MediaPlayer up, down, left, right, enter;
Private MediaPlayer a, s, d, f;
@ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. main );
// Native rate is 44.1 kHz 16 bit stereo,
// To save space we just use MPEG-3 22 kHz mono
Up = MediaPlayer. create (this, R. raw. up );
Down = MediaPlayer. create (this, R. raw. down );
Left = MediaPlayer. create (this, R. raw. left );
Right = MediaPlayer. create (this, R. raw. right );
Enter = MediaPlayer. create (this, R. raw. enter );
A = MediaPlayer. create (this, R. raw. );
S = MediaPlayer. create (this, R. raw. s );
D = MediaPlayer. create (this, R. raw. d );
F = MediaPlayer. create (this, R. raw. f );
}
@ Override
Public boolean onKeyDown (int keyCode, KeyEvent event ){
MediaPlayer mp;
Switch (keyCode ){
Case KeyEvent. KEYCODE_DPAD_UP:
Mp = up;
Break;
Case KeyEvent. KEYCODE_DPAD_DOWN:
Mp = down;
Break;
Case KeyEvent. KEYCODE_DPAD_LEFT:
Mp = left;
Break;
Case KeyEvent. KEYCODE_DPAD_RIGHT:
Mp = right;
Break;
Case KeyEvent. KEYCODE_DPAD_CENTER:
Case KeyEvent. KEYCODE_ENTER:
Mp = enter... the remaining full text>
Source code of the Android Application Development getting started tutorial (classic edition)
The source code of this book uses the Apidemos released by google as the source code.
Importing the API demos that comes with the android SDK in Eclpise is simple:
1. create a Project: File-New-Project-select Android project. Select create Project from existing source
2. Select the APIdemos path. \ android-sdk _ installation path \ android-sdk-windows \ samples \ android-7 \ ApiDemos
3. Select version. android-15, which corresponds to 4.0.
4. Click finish.
For example, the source code is com/example/android/apis/app/ReceiveResult. java, which can be found in src.