没有合适的资源?快使用搜索试试~ 我知道了~
首页Android Studio 3.2 Development Essentials - Android 9 Edition Book-Preview
Android Studio 3.2 Development Essentials - Android 9 Edition Bo...

Android Studio 3.2 Development Essentials - Android 9 Edition Book-Preview共126页
资源详情
资源评论
资源推荐

Android Studio 3.2
Development Essentials
Android 9 Edition

Android Studio 3.2 Development Essentials – Android 9 Edition
ISBN-13: 978-0960010950
© 2018 Neil Smyth / Payload Media, Inc. All Rights Reserved.
is book is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly
prohibited. All rights reserved.
e content of this book is provided for informational purposes only. Neither the publisher nor the author oers
any warranties or representation, express or implied, with regard to the accuracy of information contained in
this book, nor do they accept any liability for any loss or damage arising from any errors or omissions.
is book contains trademarked terms that are used solely for editorial purposes and to the benet of the
respective trademark owner. e terms used within this book are not intended as infringement of any trademarks.
Rev: 1.0

i
Contents
Table of Contents
1. Introduction ............................................................................................................................................... 1
1.1 Downloading the Code Samples ....................................................................................................... 1
1.2 Feedback ............................................................................................................................................... 2
1.3 Errata..................................................................................................................................................... 2
2. Setting up an Android Studio Development Environment ....................................................................... 3
2.1 System Requirements .......................................................................................................................... 3
2.2 Downloading the Android Studio Package ..................................................................................... 3
2.3 Installing Android Studio ................................................................................................................... 3
2.3.1 Installation on Windows ............................................................................................................. 4
2.3.2 Installation on macOS ................................................................................................................. 4
2.3.3 Installation on Linux .................................................................................................................... 5
2.4 e Android Studio Setup Wizard .................................................................................................... 5
2.5 Installing Additional Android SDK Packages ................................................................................. 6
2.6 Making the Android SDK Tools Command-line Accessible ......................................................... 8
2.6.1 Windows 7..................................................................................................................................... 8
2.6.2 Windows 8.1 ................................................................................................................................. 9
2.6.3 Windows 10 ................................................................................................................................ 10
2.6.4 Linux ............................................................................................................................................ 10
2.6.5 macOS .......................................................................................................................................... 10
2.7 Updating Android Studio and the SDK ......................................................................................... 10
2.8 Summary ............................................................................................................................................ 10
3. Creating an Example Android App in Android Studio ........................................................................... 11
3.1 About the Project .............................................................................................................................. 11
3.2 Creating a New Android Project ..................................................................................................... 11
3.3 Dening the Project and SDK Settings .......................................................................................... 12
3.4 Creating an Activity .......................................................................................................................... 13
3.5 Modifying the Example Application ............................................................................................... 14
3.6 Reviewing the Layout and Resource Files ...................................................................................... 21
3.7 Adding Interaction ............................................................................................................................ 23
3.8 Summary ............................................................................................................................................ 24
4. Creating an Android Virtual Device (AVD) in Android Studio ............................................................. 25
4.1 About Android Virtual Devices ...................................................................................................... 25
4.2 Creating a New AVD ........................................................................................................................ 26
4.3 Starting the Emulator ........................................................................................................................ 27
4.4 Running the Application in the AVD ............................................................................................. 27
4.5 Run/Debug Congurations.............................................................................................................. 29
4.6 Stopping a Running Application ..................................................................................................... 30
4.7 AVD Command-line Creation ........................................................................................................30
4.8 Android Virtual Device Conguration Files ................................................................................. 32
4.9 Moving and Renaming an Android Virtual Device ..................................................................... 32
4.10 Summary .......................................................................................................................................... 32

ii
Table of Contents
5. Using and Conguring the Android Studio AVD Emulator .................................................................. 33
5.1 e Emulator Environment ............................................................................................................. 33
5.2 e Emulator Toolbar Options ........................................................................................................ 33
5.3 Working in Zoom Mode .................................................................................................................. 35
5.4 Resizing the Emulator Window....................................................................................................... 35
5.5 Extended Control Options ............................................................................................................... 35
5.5.1 Location ....................................................................................................................................... 35
5.5.2 Cellular ........................................................................................................................................ 36
5.5.3 Camera ......................................................................................................................................... 36
5.5.4 Battery .......................................................................................................................................... 36
5.5.5 Phone ........................................................................................................................................... 36
5.5.6 Directional Pad ........................................................................................................................... 36
5.5.7 Microphone ................................................................................................................................. 36
5.5.8 Fingerprint .................................................................................................................................. 36
5.5.9 Virtual Sensors ............................................................................................................................36
5.5.10 Snapshots ................................................................................................................................... 36
5.5.11 Screen Record ........................................................................................................................... 36
5.5.12 Google Play ............................................................................................................................... 37
5.5.13 Settings ...................................................................................................................................... 37
5.5.14 Help ............................................................................................................................................ 37
5.6 Working with Snapshots ................................................................................................................... 37
5.7 Drag and Drop Support .................................................................................................................... 38
5.8 Conguring Fingerprint Emulation ............................................................................................... 39
5.9 Summary ............................................................................................................................................ 40
6. A Tour of the Android Studio User Interface .......................................................................................... 41
6.1 e Welcome Screen ......................................................................................................................... 41
6.2 e Main Window ............................................................................................................................ 42
6.3 e Tool Windows ............................................................................................................................ 43
6.4 Android Studio Keyboard Shortcuts .............................................................................................. 46
6.5 Switcher and Recent Files Navigation ............................................................................................ 46
6.6 Changing the Android Studio eme ............................................................................................ 47
6.7 Summary ............................................................................................................................................ 47
7. Testing Android Studio Apps on a Physical Android Device .................................................................. 49
7.1 An Overview of the Android Debug Bridge (ADB) ..................................................................... 49
7.2 Enabling ADB on Android based Devices .................................................................................... 49
7.2.1 macOS ADB Conguration ...................................................................................................... 50
7.2.2 Windows ADB Conguration .................................................................................................. 51
7.2.3 Linux adb Conguration ........................................................................................................... 52
7.3 Testing the adb Connection ............................................................................................................. 52
7.4 Summary ............................................................................................................................................ 53
8. e Basics of the Android Studio Code Editor ........................................................................................ 55
8.1 e Android Studio Editor............................................................................................................... 55
8.2 Splitting the Editor Window ............................................................................................................ 57
8.3 Code Completion .............................................................................................................................. 58
8.4 Statement Completion ...................................................................................................................... 59
8.5 Parameter Information ..................................................................................................................... 59
8.6 Parameter Name Hints ..................................................................................................................... 60

iii
Table of Contents
8.7 Code Generation ............................................................................................................................... 60
8.8 Code Folding ...................................................................................................................................... 61
8.9 Quick Documentation Lookup ....................................................................................................... 62
8.10 Code Reformatting..........................................................................................................................63
8.11 Finding Sample Code ..................................................................................................................... 63
8.12 Summary .......................................................................................................................................... 64
9. An Overview of the Android Architecture .............................................................................................. 65
9.1 e Android Soware Stack ............................................................................................................ 65
9.2 e Linux Kernel ...............................................................................................................................66
9.3 Android Runtime – ART .................................................................................................................. 66
9.4 Android Libraries .............................................................................................................................. 66
9.4.1 C/C++ Libraries ......................................................................................................................... 67
9.5 Application Framework .................................................................................................................... 67
9.6 Applications ....................................................................................................................................... 68
9.7 Summary ............................................................................................................................................ 68
10. e Anatomy of an Android Application .............................................................................................. 69
10.1 Android Activities ........................................................................................................................... 69
10.2 Android Fragments ......................................................................................................................... 69
10.3 Android Intents ............................................................................................................................... 70
10.4 Broadcast Intents ............................................................................................................................. 70
10.5 Broadcast Receivers ........................................................................................................................ 70
10.6 Android Services ............................................................................................................................. 70
10.7 Content Providers ........................................................................................................................... 71
10.8 e Application Manifest ............................................................................................................... 71
10.9 Application Resources .................................................................................................................... 71
10.10 Application Context ...................................................................................................................... 71
10.11 Summary ........................................................................................................................................ 71
11. Understanding Android Application and Activity Lifecycles ............................................................... 73
11.1 Android Applications and Resource Management ..................................................................... 73
11.2 Android Process States ................................................................................................................... 73
11.2.1 Foreground Process ................................................................................................................. 74
11.2.2 Visible Process .......................................................................................................................... 74
11.2.3 Service Process ......................................................................................................................... 74
11.2.4 Background Process ................................................................................................................. 74
11.2.5 Empty Process .......................................................................................................................... 75
11.3 Inter-Process Dependencies ......................................................................................................... 75
11.4 e Activity Lifecycle ...................................................................................................................... 75
11.5 e Activity Stack ............................................................................................................................ 75
11.6 Activity States .................................................................................................................................. 76
11.7 Conguration Changes .................................................................................................................. 76
11.8 Handling State Change ................................................................................................................... 77
11.9 Summary .......................................................................................................................................... 77
12. Handling Android Activity State Changes............................................................................................. 79
12.1 New vs. Old Lifecycle Techniques ................................................................................................. 79
12.2 e Activity and Fragment Classes ............................................................................................... 79
12.3 Dynamic State vs. Persistent State ................................................................................................. 82
12.4 e Android Lifecycle Methods .................................................................................................... 82
剩余125页未读,继续阅读


















安全验证
文档复制为VIP权益,开通VIP直接复制

评论3