Example: bachelor of science

Android Studio Development Essentials

Android Studio Development Essentials Android Studio Development Essentials Second Edition 2015 Neil Smyth. All Rights Reserved. This book is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly prohibited. All rights reserved. The content of this book is provided for informational purposes only. Neither the publisher nor the author offers 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.

iii 10. Understanding Android Application and Activity Lifecycles..... 71

Tags:

  Android

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of Android Studio Development Essentials

1 Android Studio Development Essentials Android Studio Development Essentials Second Edition 2015 Neil Smyth. All Rights Reserved. This book is provided for personal use only. Unauthorized use, reproduction and/or distribution strictly prohibited. All rights reserved. The content of this book is provided for informational purposes only. Neither the publisher nor the author offers 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.

2 This book contains trademarked terms that are used solely for editorial purposes and to the benefit of the respective trademark owner. The terms used within this book are not intended as infringement of any trademarks. Rev i Table of Contents 1. 1 Downloading the Code Samples .. 1 Feedback .. 1 Errata .. 1 2. Setting up an Android Studio Development Environment .. 3 System Requirements .. 3 Installing the Java Development Kit (JDK) .. 3 Windows JDK Installation .. 3 Mac OS X JDK 4 Linux JDK Installation .. 4 Downloading the Android Studio Package .. 5 Installing Android Studio .

3 5 Installation on Windows .. 5 Installation on Mac OS X .. 6 Installation on Linux .. 7 The Android Studio Setup Wizard .. 7 Installing the Latest Android SDK Packages .. 8 Making the Android SDK Tools Command-line Accessible .. 10 Windows 7 .. 10 Windows .. 11 Linux .. 11 Mac OS X .. 12 Updating the Android Studio and the SDK .. 12 Summary .. 12 3. Creating an Example Android App in Android Studio .. 13 Creating a New Android Project .. 13 Defining the Project and SDK Settings .. 14 Creating an 15 Modifying the Example 16 Reviewing the Layout and Resource 20 Previewing the Layout.

4 22 Summary .. 23 4. A Tour of the Android Studio User Interface .. 25 The Welcome Screen .. 25 The Main Window .. 26 The Tool Windows .. 27 Android Studio Keyboard Shortcuts .. 30 Switcher and Recent Files 30 Changing the Android Studio Theme .. 31 Summary .. 31 5. Creating an Android Virtual Device (AVD) in Android Studio .. 33 About Android Virtual Devices .. 33 Creating a New AVD .. 34 ii Starting the Emulator .. 36 Running the Application in the AVD .. 36 Run/Debug Configurations .. 38 Stopping a Running 39 AVD Command-line Creation .. 41 Android Virtual Device Configuration Files.

5 42 Moving and Renaming an Android Virtual Device .. 42 Summary .. 43 6. Testing Android Studio Apps on a Physical Android Device .. 45 An Overview of the Android Debug Bridge (ADB) .. 45 Enabling ADB on Android based Devices .. 45 Mac OS X ADB 46 Windows ADB Configuration .. 47 Linux adb Configuration .. 49 Testing the adb Connection .. 50 Summary .. 51 7. The Basics of the Android Studio Code Editor .. 53 The Android Studio Editor .. 53 Splitting the Editor Window .. 55 Code Completion .. 56 Statement Completion .. 57 Parameter Information .. 57 Code 57 Code Folding.

6 59 Quick Documentation Lookup .. 60 Code Reformatting .. 60 Summary .. 61 8. An Overview of the Android Architecture .. 63 The Android Software Stack .. 63 The Linux Kernel .. 64 Android Runtime ART .. 64 Android Libraries .. 65 C/C++ Libraries .. 65 Application Framework .. 66 Applications .. 66 Summary .. 66 9. The Anatomy of an Android Application .. 67 Android Activities .. 67 Android Intents .. 67 Broadcast Intents .. 68 Broadcast 68 Android Services .. 68 Content Providers .. 68 The Application 69 Application Resources .. 69 Application Context.

7 69 Summary .. 69 iii 10. Understanding Android Application and Activity Lifecycles .. 71 Android Applications and Resource Management .. 71 Android Process States .. 71 Foreground Process .. 72 Visible Process .. 72 Service Process .. 72 Background Process .. 72 Empty Process .. 73 Inter-Process Dependencies .. 73 The Activity Lifecycle .. 73 The Activity Stack .. 73 Activity States .. 74 Configuration Changes .. 75 Handling State 75 Summary .. 75 11. Handling Android Activity State Changes .. 77 The Activity Class .. 77 Dynamic State vs. Persistent State .. 79 The Android Activity Lifecycle Methods.

8 79 Activity Lifetimes .. 81 Summary .. 81 12. Android Activity State Changes by Example .. 83 Creating the State Change Example Project .. 83 Designing the User Interface .. 84 Overriding the Activity Lifecycle Methods .. 86 Filtering the LogCat Panel .. 88 Running the Application .. 89 Experimenting with the Activity .. 90 Summary .. 91 13. Saving and Restoring the State of an Android Activity .. 93 Saving Dynamic 93 Default Saving of User Interface State .. 93 The Bundle Class .. 94 Saving the State .. 95 Restoring the State .. 96 Testing the Application .. 96 Summary.

9 97 14. Understanding Android Views, View Groups and Layouts .. 99 Designing for Different Android Devices .. 99 Views and View Groups .. 99 Android Layout Managers .. 99 The View Hierarchy .. 100 Creating User Interfaces .. 102 Summary .. 102 15. A Guide to the Android Studio Designer Tool .. 103 iv The Android Studio Designer .. 103 Design Mode .. 103 Text 105 Setting Properties .. 105 Type Morphing .. 106 Creating a Custom Device Definition .. 107 Summary .. 107 16. Designing a User Interface using the Android Studio Designer Tool .. 109 An Android Studio Designer Tool Example.

10 109 Creating a New Activity .. 109 Designing the User Interface .. 111 Editing View Properties .. 111 Running the Application .. 112 Manually Creating an XML Layout .. 112 Using the Hierarchy Viewer .. 114 Summary .. 117 17. Creating an Android User Interface in Java Code .. 119 Java Code vs. XML Layout Files .. 119 Creating Views .. 119 Properties and Layout Parameters .. 120 Creating the Example Project in Android Studio .. 120 Adding Views to an Activity .. 121 Setting View Properties .. 122 Adding Layout Parameters and Rules .. 123 Using View IDs .. 124 Converting Density Independent Pixels (dp) to Pixels (px).


Related search queries