Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分

所需积分/C币:12 2016-12-07 18:37:32 31.49MB PDF
收藏 收藏

Android编程指南(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015年英文原版,0积分——该书是最新的英文第2版,全书640页。
Dedication TO God, or to whatever it is that you personally have faith in. Reader, I hope that you find the many explanations in this book useful. Please don't ask me how they got here, though. I once thought that / was responsible. Fortunately for you, I was wrong BP To my dad, David, for teaching me the value of hard work. To my mom, Lisa, for pushing me to always do the right thing CS For Donovan. May he live a life filled with activities and know when to use fragments BH To my dad, Dave vadas, for inspiring and encouraging me to pursue a career in computing. And to my mom, Joan vadas, for cheering me on through all the ups and downs(and for reminding me that watching an episode of The Golden girls always makes things better) KM Acknowledgments We feel a bit sheepish having our names on the cover of this book The truth is that without an army of collaborators, this book could never have happened We owe them all a debt of gratitude Our co-instructors and members of our android development team andrew lunsford, bolot Kerimbaev Brian gardner, David greenhalgh, Jason Atwood, Josh skeen, Kurt Nelson, Matt Compton, Paul Turner, and Sean Farrell. We thank them for their patience in teaching work- in-progress material, as well as their suggestions and corrections. If we could give ourselves additional brains to do with as we pleased, we would not. We would just put the new brains in a big pile, and share them with our colleagues. We trust them at least as much as we trust our own selves Special thanks to Sean Farrell for graciously updating many screen shots as android studio evolved, and to Matt Compton for publishing all of our sample apps to the Google Play Store Kar Loong Wong and Zack Simon, members of Big Nerd ranch's amazing design team. Kar made Beat Box look intimidating and polished, and provided advice and imagery for the material design chapter. Zack took time out of his schedule to design mock walker for us. Kar and Zacks design abilities seem like unknowable superpowers to us. We thank them, and bid them fond returns to their home planet Our technical reviewers, Frank robles and roy Kravitz, who helped us find and fix flaws Thanks to Aaron Hillegass. Aaron's faith in people is one of the great and terrifying forces of nature. Without it, we would never have had the opportunity to write this book, nor would we ever have completed it. (He also gave us money, which was very friendly of him.) Our editor, Elizabeth Holaday, who many times saved us from going down rabbit holes. She kept our writing focused on what our readers actually care about and spared you all from confusing boring, and irrelevant detours. Thank you, Liz, for being organized and patient, and for being a constant supportive presence, even though you live many miles away Ellie Volckhausen, who designed our cover Simone Payment, our copy-editor, who found and smoothed rough spots Chris loper at IntelligentEnglish. com, who designed and produced the print book and the epuB and Kindle versions his doc book toolchain made life much easier. too Finally thanks to our students We wish that we had room to thank every single student who gave us a correction or opinion on the book as it was shaping up It is your curiosity we have worked to satisfy your confusions we have worked to clarify. Thank you Table of contents Learning Android Prerequisites What's New in the Second Edition? How to Use this book How This book is Organized Challenges XIX Are you more curious?......................................... xiX Code style Typographical Conventions Android versions XⅩ The Necessary Tools… Downloading and installing android studio Downloading Earlier sdK versions ∴XX An Alternative emulator KXII a Hardware Device XXII Your First Android Application App Basics Creating an Android Project 228 Navigating in Android Studio……..…,.8 Laying Out the User Interface……...…..……….9 The view hierarchy Widget attributes 14 Creating string resources 15 Previewing the layout 15 From LayoutⅹMLtoⅤ iew Objects...16 Resources and resource ids 18 Wiring Up Widgets 20 Getting references to widgets Setting listeners 22 Making toasts… .23 Using code completion……………….25 Running on the emulator 26 For the more curious: Android Build process 0 Android build tools 31 2. Android and Model-View-Controller 33 Creating a New Class 34 Model-View-Controller and Android Generating getters and setters ∴34 37 Benefits of mvc 38 Updating the view Layer .39 Updating the Controller Layer 41 Running on a device 46 Connecting your device 46 Configuring your device for development 47 Adding an Icon 48 Android Programming Adding resources to a project 49 Referencing resources in XML 52 Challenges 53 Challenge: Add a listener to the text view……....…..…….53 Challenge: Add a Previous Button 54 Challenge: From Button to ImageButton ∴55 3. The Activity Lifecycle 57 gging the Activity lifecycle………...….…….58 Making log messages… 58 Using log Cat 60 Rotation and the activity lifecycle Device configurations and alternative resources Saving Data Across rotation 8 Overriding on SavelnstanceState(Bundle)......................69 The Activity Lifecycle, Revisited...….….….70 For the More Curious: Testing onSaveInstance State(Bundle) For the more curious logging levels and methods 4. Debugging Android Apps……… ∴.75 Exceptions and Stack Traces 76 Diagnosing misbehaviors gging stack 78 Setting breakpoints Using exception breakpoints Android-Specific Debugging .84 Using Android Lint…… 84 Issues with ther class 85 87 Setting Up a Second Activity 88 Creating 89 A 92 Declaring activities in the manifest 92 Adding a Cheat! button to quizActivity……93 Starting an Activity… Communicating with intents 96 Passing data between activities 门7 Using intent extras 98 Getting a result back from a child activity.…… 101 HowAndroidseesyouractivities.....wwwwwwwwwwwgwwwwwww..106 Challenge… .109 6. Android SdK Versions and compatibility Android sdk versions Compatibility and Android Programming 鲁 a sane minimum Minimum sdk version 114 Target SDK version 114 Compile sdk version 114 Adding code from later APIs safel .114 USing the android Developer Documentation .117 llI Android Programming Challenge: Reporting the Build Version 19 7. UI Fragments and the fragment manager 121 The Need for UI Flexibility 122 Introducing Fragments 123 Starting CriminalIntent 124 Creating a new project 126 Fragments and the support library .128 Adding dependencies in Android Studio........................... 129 Creating the Crime cla 132 Hosting a ui fragment 133 The fragment lifecycle 133 Twe ches to hosti 134 Defining a container view .135 Creating a UI Fragment 136 Defining( rimeFragment' s layout……………… 136 Creating the CrimeFragment class 138 Adding a UI Fragment to the FragmentManager………………………,142 Fragment transactions The FragmentManager and the fragment lifecycle .143 145 pplication Architecture with Fragments .146 The reason all our activities will use fragments………147 For the More Curious: Why Support Fragments are Superior 148 For the more Curious: USing built-In fragments 148 8. Creating User Interfaces with Layouts and widgets 149 Upgrading Crime∴… 149 Updating the Layout 150 Wiring widgets… 153 More on XMl layout Attributes 154 Styles, themes, and theme attribut 154 Screen pixel densities and dp and .155 Androids design guidelines 5 Layout parameters 5 margins vs padding 157 USing the Graphical Layout Tool 158 Creating a landscape layout 160 Adding a new widget 16l Editing attributes in properties view 161 Reorganizing widgets in the component tree….……….162 Updating child layout parameters 163 How android: layout_ weight works 164 The graphical layout tool and you 165 Widget Ids and multiple layouts 166 Challenge: Formatting the date 166 playing lists with Recycler View 167 Updating CriminalIntent' s Model layer…… Singletons and centralized data storage 168 An Abstract Activity for Hosting a Fragment ∴171 A fragment-hosting layout 171 X Android Programming An abstract Activity class Recycler view, Adapter, and view Holder 176 View Holders and Adapters 177 a Recycler view 180 Implementing an adapter and view holder 182 Customizing List Items…… 185 Creating the list item layout 185 Using a custom item view 188 Responding to Presses... .190 For the more curious:ListⅤ iew and gridⅤiew∴ .191 For the more curious singletons 192 10. USing Fragment Arguments ∴.193 Starting an Activity from a fragment 193 Putting an extra. ............................................................................................194 Retrieving an extra....... 195 Updating crime fragments view with Crime data 196 The downside to direct retrieval .197 Fragment Arguments .197 Attaching arguments to a fragment 198 Retrieving arguments 00 Reloading the list… 200 Getting Results with Fragments 202 Challenge: Efficient Recycler View Reloading .203 For the More Curious: Why Use Fragment Arguments? 204 11. Using View Pager 205 Creating( rimePagerActivity………….206 View Pager and pagerAdapter 207 Integrating CrimePagerActivity 208 FragmentStatePager Adapter vs. FragmentPagerAdapter 211 For the more Curious: How view Pager really works 212 For the more curious: laying out views in Code 213 12. Dialogs 215 The App Compat Library 216 Creating a Dialog Fragment 217 Showing a dialog fragment .220 Setting a dialog's contents 221 Passing Data Between Two Fragments 224 Passing data to DatePicker Fragment…..….…….225 Returning data to Crime fragment 226 Challenge: More Dialogs 233 Challenge: A Responsive Dialog Fragment 233 13. The Toolbar 235 compat 235 Using the AppCompat library……………… 236 Menus 238 Defining a menu in XML 239 Creating the menu 244 Responding to menu selections 246

试读 127P Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分
限时抽奖 低至0.43元/次
身份认证后 购VIP低至7折
waterwalk Very good book, thanks a lot.
  • 分享王者

关注 私信
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分 12积分/C币 立即下载
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第1页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第2页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第3页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第4页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第5页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第6页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第7页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第8页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第9页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第10页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第11页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第12页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第13页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第14页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第15页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第16页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第17页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第18页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第19页
Android编程(Android Programming-The Big Nerd Ranch Guide, 2nd Edition)-2015英文书,0积分第20页

试读结束, 可继续阅读

12积分/C币 立即下载