The Busy Coder’s Guide To Android Development (Final Version) - (Mark L. Murphy) (z-library.sk, 1lib.sk, z-lib.sk)
Author: Mark L. Murphy
移动
No Description
📄 File Format:
PDF
💾 File Size:
36.3 MB
13
Views
0
Downloads
0.00
Total Donations
📄 Text Preview (First 20 pages)
ℹ️
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
📄 Page
1
(This page has no text content)
📄 Page
2
Table of Contents Headings formatted in bold-italic have changed since the last version. Preface Welcome to the Book! First-Generation Book The Book’s Structure The Trails About the Updates About the APK Edition Source Code and Its License Creative Commons and the Four-to-Free (42F) Guarantee Acknowledgments Key Android Concepts Android Applications Android Devices Don’t Be Scared Choosing Your Development Toolchain Android Studio Eclipse IntelliJ IDEA Command-Line Builds via Gradle Yet Other Alternatives IDEs… And This Book What We Are Not Covering Tutorial #1 - Installing the Tools But First, Some Notes About Android’s Emulator Step #1: Checking Your Hardware Step #2: Setting Up Java and 32-Bit Linux Support Step #3: Install Android Studio Step #4: Install the SDKs and Add-Ons In Our Next Episode… Android and Projects Projects and Android Studio Tutorial #2 - Creating a Stub Project
📄 Page
3
About Our Tutorial Project About the Rest of the Tutorials About Our Tools Step #1: Importing the Project Step #2: Get Ready for the x86 Emulator Step #3: Set Up the AVD Step #4: Set Up the Device Step #5: Running the Project In Our Next Episode… Getting Around Android Studio Navigating The Project Explorer Running Projects Viewing Output Accessing Android Tools Android Studio and Release Channels Visit the Trails! Contents of Android Projects What You Get, In General More About the Directory Structure What You Get Out Of It Introducing Gradle and the Manifest Gradle: The Big Questions Obtaining Gradle Versions of Gradle and the Android Gradle Plugin Gradle Environment Variables Examining the Gradle Files Introducing the Manifest Things In Common Between the Manifest and Gradle Other Gradle Items of Note Where’s the GUI? The Rest of the Manifest Learning More About Gradle Visit the Trails! Tutorial #3 - Manifest Changes Some Notes About Relative Paths Step #1: Supporting Screens Step #2: Blocking Backups Step #3: Ignoring Lint In Our Next Episode…
📄 Page
4
Some Words About Resources String Theory Got the Picture? Dimensions The Resource That Shall Not Be Named… Yet Icons App Icons… And Everything Else Creating an App Icon with the Asset Studio Creating Other Icons with the Asset Studio Tutorial #4 - Adjusting Our Resources Step #1: Changing the Name Step #2: Changing the Icon Step #3: Running the Result In Our Next Episode… The Theory of Widgets What Are Widgets? Size, Margins, and Padding What Are Containers? The Absolute Positioning Anti-Pattern The Theme of This Section: Themes The Android User Interface The Activity Dissecting the Activity Using XML-Based Layouts Basic Widgets Common Concepts Introducing the Graphical Layout Editor And Now, Some Notes About the Book’s Sample Projects Assigning Labels A Commanding Button Fleeting Images Fields of Green. Or Other Colors. More Common Concepts Visit the Trails! Debugging Your App Get Thee To a Stack Trace The Case of the Confounding Class Cast Point Break The Classic Container Classes
📄 Page
5
Introducing the Sampler App RTL and Your Layouts LinearLayout and the Box Model All Things Are Relative Tabula Rasa Hey, What About ConstraintLayout? Turning Back to RTL Other Common Widgets and Containers Just a Box to Check Don’t Like Checkboxes? How About Toggles or Switches? Turn the Radio Up Scrollwork Making Progress with ProgressBars Framing the Scene Visit the Trails! Tutorial #5 - Creating a Layout Step #1: Creating a New Layout Resource Step #2: Defining the UI In Our Next Episode… GUI Building, Continued Making Your Selection Including Includes Preview of Coming Attractions AdapterViews and Adapters Adapting to the Circumstances Lists of Naughty and Nice Clicks versus Selections Spin Control Grid Your Lions (Or Something Like That…) Fields: Now With 35% Less Typing! Customizing the Adapter Visit the Trails! The WebView Widget Role of WebView Daddy, Where Do WebViews Come From? Adding the Widget Loading Content Via a URL Links and Redirects Supporting JavaScript
📄 Page
6
Alternatives for Loading Content Listening for Events Addressing the Link/Redirect Behavior Opting Out of Google Monitoring Visit the Trails! Defining and Using Styles Styles: DIY DRY Elements of Style Themes: Would a Style By Any Other Name… What Happens If You Have No Theme Android Studio’s Theme Editor Dependencies What’s a Dependency? Dependency Scopes Depending on a Local JAR What’s an Artifact? Artifacts and Repositories Major Library Families from Google Requesting Dependencies The Android Support Library Tutorial #6 - Adding a Library Step #1: Getting Rid of Existing Cruft Step #2: Requesting New Dependencies In Our Next Episode… Introducing ConstraintLayout Why Another Container? Comparing with the Classics Getting ConstraintLayout Using Widgets and Containers from Libraries Using a ConstraintLayout Converting Existing Layouts Visit the Trails! RecyclerView AdapterView and its Discontents Enter RecyclerView A Trivial List Divider Options Handling Click Events Visit the Trails!
📄 Page
7
The Action Bar Bar Hopping Yet Another History Lesson Your Action Bar Options Setting the Target Defining the Resource Applying the Resource Responding to Events The Rest of the Sample Activity MENU Key, We Hardly Knew Ye Action Bars, Live in Living Color! Visit the Trails! Vector Drawables Getting the Artwork VectorDrawableCompat Tutorial #7 - Setting Up the Action Bar Step #1: Adding Some Icons Step #2: Defining Some Options Step #3: Loading and Responding to Our Options Step #4: Supporting Older Devices Step #5: Trying It Out In Our Next Episode… Android’s Process Model When Processes Are Created BACK, HOME, and Your Process Termination Foreground Means “I Love You” You and Your Heap Activities and Their Lifecycles Creating Your Second (and Third and…) Activity Warning! Contains Explicit Intents! Using Implicit Intents Extra! Extra! Pondering Parcelable Asynchronicity and Results Schroedinger’s Activity Life, Death, and Your Activity When Activities Die Walking Through the Lifecycle
📄 Page
8
Recycling Activities Application: Transcending the Activity The Case of the Invisible Activity Tutorial #8 - Setting Up An Activity Step #1: Creating the Stub Activity Class and Manifest Entry Step #2: Launching Our Activity In Our Next Episode… The Tactics of Fragments The Six Questions Where You Get Your Fragments From Your First Fragment The Fragment Lifecycle Methods Your First Dynamic Fragment Fragments and the Action Bar Tutorial #9 - Starting Our Fragments Step #1: Create a SimpleContentFragment Step #2: Examining SimpleContentFragment In Our Next Episode… Swiping with ViewPager Pieces of a Pager Paging Fragments Paging Other Stuff Indicators Revisiting the Containers Sampler Tutorial #10 - Rigging Up a ViewPager Step #1: Add a ViewPager to the Layout Step #2: Creating a ContentsAdapter Step #3: Setting Up the ViewPager In Our Next Episode… Resource Sets and Configurations What’s a Configuration? And How Do They Change? Configurations and Resource Sets Screen Size and Orientation Coping with Complexity Choosing The Right Resource API-Versioned Resources Default Change Behavior State Saving Scenarios Your Options for Configuration Changes
📄 Page
9
Blocking Rotations And Now, a Word From the Android Project View Configuration Challenges Material Design Basics Your App, in Technicolor! Dealing with Threads The Main Application Thread Getting to the Background Asyncing Feeling Alternatives to AsyncTask And Now, The Caveats Event Buses Visit the Trails! Requesting Permissions Frequently-Asked Questions About Permissions Characteristics of Permissions New Permissions in Old Applications Android 6.0+ Runtime Permission System A Simple Runtime Permission Abstraction Assets, Files, and Data Parsing Packaging Files with Your App Files and Android Working with Internal Storage Working with External Storage Removable Storage Multiple User Accounts Linux Filesystems: You Sync, You Win StrictMode: Avoiding Janky Code Files, and Your Development Machine XML Parsing Options JSON Parsing Options Using Files with Implicit Intents Visit the Trails! Tutorial #11 - Adding Simple Content Step #1: Adding Some Content Step #2: Using SimpleContentFragment Step #3: Launching Our Activities, For Real This Time Step #4: Getting a Bit More Material Step #5: Seeing the Results
📄 Page
10
In Our Next Episode… Tutorial #12 - Displaying the Book Step #1: Adding a Book Step #2: Creating a ModelFragment Step #3: Defining Our Model Step #4: Examining Our Model Step #5: Defining Our Event Step #6: Loading Our Model Step #7: Registering for Events Step #8: Adapting the Content Step #9: Showing the Content When Loaded Step #10: Attaching our ModelFragment Step #11: Showing the Content After a Configuration Change Step #12: Setting Up StrictMode In Our Next Episode… Using Preferences Getting What You Want Stating Your Preference Collecting Preferences with PreferenceFragment Android Studio’s Preferences Editor Types of Preferences Tutorial #13 - Using Some Preferences Step #1: Defining the Preference XML Files Step #2: Creating Our Preference Activity Step #3: Adding To Our Action Bar Step #4: Launching the Preference Activity Step #5: Loading the Preferences Step #6: Saving the Last-Read Position Step #7: Restoring the Last-Read Position Step #8: Keeping the Screen On In Our Next Episode… SQLite Databases Introducing SQLite Thinking About Schemas Start with a Helper Getting Data Out The Rest of the CRUD Hey, What About Hibernate? But, What About Room?
📄 Page
11
Visit the Trails! Tutorial #14 - Saving Notes Step #1: Adding a DatabaseHelper Step #2: Examining DatabaseHelper Step #3: Creating a NoteFragment Step #4: Examining NoteFragment Step #5: Creating the NoteActivity Step #6: Examining NoteActivity Step #7: Add Notes to the Action Bar Step #8: Defining a NoteLoadedEvent Step #9: Loading a Note from the Database Step #10: Loading the Note Into the Fragment Step #11: Updating the Database Step #12: Saving the Note Step #13: Adding a Delete Action Bar Item Step #14: Closing the NoteFragment When Deleted In Our Next Episode… Internet Access DIY HTTP What About HttpClient? HTTP via DownloadManager Using Third-Party Libraries SSL Using HTTP Client Libraries Visit the Trails Intents, Intent Filters What’s Your Intent? Stating Your Intent(ions) Responding to Implicit Intents Requesting Implicit Intents ShareActionProvider Practice Safe Content Resolution Broadcasts and Broadcast Receivers The Stopped State Example System Broadcasts The Order of Things Keeping It Local Visit the Trails! Tutorial #15 - Sharing Your Notes
📄 Page
12
Step #1: Adding a ShareActionProvider Step #2: Sharing the Note Step #3: Testing the Result In Our Next Episode… Services and the Command Pattern Why Services? Setting Up a Service Communicating To Services Scenario: The Music Player The Power of the PendingIntent Communicating From Services Scenario: The Downloader JobIntentService IntentService or JobIntentService? Services and Configuration Changes When Do Services End? Background Service Limitations Tutorial #16 - Updating the Book Step #1: Adding a Stub DownloadCheckService Step #2: Tying the Service Into the Action Bar Step #3: Defining Our Event Step #4: Defining Our JSON Step #5: Defining Our Retrofit Interface Step #6: Retrieving Our JSON Via Retrofit Step #7: Downloading the Update Step #8: Unpacking the Update Step #9: Using the Update In Our Next Episode… Tutorial #17 - Supporting Large Screens Step #1: Creating Our Layouts Step #2: Loading Our Sidebar Widgets Step #3: Opening the Sidebar Step #4: Loading Content Into the Sidebar Step #5: Removing Content From the Sidebar Backwards Compatibility Strategies and Tactics Think Forwards, Not Backwards Aim Where You Are Going A Target-Rich Environment Lint: It’s Not Just For Belly Buttons
📄 Page
13
A Little Help From Your Friends Avoid the New on the Old Testing Keeping Track of Changes System Services What is a System Service? What System Services Are There? Google Play Services What Is Google Play Services? What Is In the Play Services SDK? Adding Play Services to Your Project Getting Help Questions. Sometimes, With Answers. Heading to the Source Working with Library Modules Prerequisites Creating a Library Module Using a Library Module Library Modules and the Manifest Library Modules and Transitive Dependencies Limitations of Library Modules Gradle and Tasks Key Build-Related Tasks Results Gradle Build Variants Prerequisites Objectives of the Project Structure Terminology Configuring the Stock Build Types Adding Build Types Adding Product Flavors and Getting Build Variants Doing the Splits Gradle and Android Studio Manifest Merger Rules Prerequisites Manifest Scenarios Pieces of Manifest Generation Examining the Merger Results Viewing Merged Manifests in Android Studio
📄 Page
14
Merging Elements and Attributes Employing Placeholders Signing Your App Prerequisites Role of Code Signing What Happens In Debug Mode Production Signing Keys Distribution Prerequisites Get Ready To Go To Market Writing a Gradle Plugin Prerequisites Customizing a Gradle Build Some Use Cases for a Custom Plugin Writing a Plugin Distributing the Plugin Using the Plugin Creating a Real Plugin Code Generation Prerequisites What Drives the Custom Code? Java as Poetry Writing a Code Generation Plugin Using the Generated Code Advanced Gradle for Android Tips Prerequisites Gradle, DRY Automating APK Version Information Adding to BuildConfig Testing with JUnit4 Prerequisites Instrumentation Tests and Unit Tests Writing JUnit4 Test Cases Configuring Gradle Running Your Instrumentation Tests Testing Android Library Projects Testing and Runtime Permissions The Android Test Orchestrator Testing with Espresso
📄 Page
15
Prerequisites Adding a Shot of Espresso Writing Tests in Espresso The Espresso Test Recorder Stronger Espresso Opting Out of Analytics Waiting for the World to Change Testing with UI Automator Prerequisites What Is UI Automator? Why Choose UI Automator Over Alternatives? Gradle and Android Studio Settings Creating a Test Case Performing Device-Level Actions Starting Your Activity Getting Proxies for Widgets and Containers Interacting with Widgets Asserting Conditions Running Your Tests Finding Your Widgets Using the UI Automator Viewer Measuring Test Coverage Prerequisites Who Tests the Testers? Some Types of Test Coverage Coverage and Your Instrumentation Tests Unit Testing Prerequisites I Thought We Were Already Unit Testing? Scenario: Clean Architecture Setting Up Unit Testing Writing POJO Unit Tests Running Unit Tests Mocking Android MonkeyRunner and the Test Monkey Prerequisites MonkeyRunner Monkeying Around Java 8 Lambda Expressions
📄 Page
16
Prerequisites The Basic Idea Using Lambda Expressions Alternative: Method References Rx Basics Prerequisites Life is But a Stream Action and Reaction A Rx For What Ails You Rx and Lambdas A Simple Stream Be Your Own Stream Removing the AsyncTask Lambdas and Lifetimes Streaming from a Resource Error Handling Transmogrification Rx-Enabled Libraries Further Reading What About LiveData? Notifications Prerequisites What’s a Notification? Notifications and Channels Showing a Simple Notification The Activity-Or-Notification Scenario Big (and Rich) Notifications Foreground Services Disabled Notifications Advanced Notifications Prerequisites Being a Good Citizen More About Channels Wear? There! Stacking Notifications Avoiding Wear Other Wear-Specific Notification Options Remote Input, On-Device Notification Groups
📄 Page
17
Lockscreen Notifications Priority, Importance, and HeadsUp Notifications Full-Screen Notifications Progress Notifications Custom Views Life After Delete The Mysterious Case of the Missing Number Notifications and MessagingStyle Changes in API Level 23 Sounds and Android 7.0 Auto-Timeout Multi-Window Support Prerequisites A History of Windows What The User Sees What Your Code Sees Opting Out Opting In Configuring the Layout Avoiding Stutter Managing the Background How Low Can You Go? Parallel Processing Split-Screen, HOME, and Your Activity Split-Screen and Orientations Forcing Your App Into Multi-Window/Multi-Instance Supporting Legacy Proprietary Multi-Window Freeform Multi-Window Mode Picture-in-Picture Multi-Display Support Advanced ConstraintLayout Prerequisites Barriers to Entry Disclosing Your Bias Centering Yourself Keeping Things Proportional Constraining Sizes Chains, Without the Whips Going in a Circle
📄 Page
18
Groups of Views… But Not ViewGroups GridLayout Prerequisites Issues with the Classic Containers The New Contender: GridLayout GridLayout and the Android Support Package Our Test App Replacing the Classics Implicit Rows and Columns Row and Column Spans Dialogs and DialogFragments Prerequisites DatePickerDialog and TimePickerDialog AlertDialog DialogFragments DialogFragment: The Other Flavor Dialogs: Modal, Not Blocking Advanced ListViews Prerequisites Multiple Row Types, and Self Inflation Choice Modes and the Activated Style Custom Mutable Row Contents From Head To Toe Enter RecyclerView Action Modes Prerequisites A Matter of Context Manual Action Modes Multiple-Choice-Modal Action Modes Long-Click To Initiate an Action Mode Other Advanced Action Bar Techniques Prerequisites Action Layouts Action Views and Action Providers Searching with SearchView Floating Action Bars Toolbar Prerequisites Basic Toolbar Mechanics
📄 Page
19
Use Case: Split Action Bar Use Case #2: Replacement Action Bar AppCompat: The Official Action Bar Backport Prerequisites Ummmm… Why? The Basics of Using AppCompat Other AppCompat Effects Toolbar and AppCompat To Material, or Not to Material The Android Design Support Library Prerequisites GUIs and the Support Package Adding the Library… and What Comes With It Introducing CWAC-CrossPort Snackbars: Sweeter than Toasts Absolutely FABulous Material Tabs with TabLayout Floating Labels Advanced RecyclerView Prerequisites What About Cursors? Grids Varying the Items Mutable Row Contents Changing the Contents The Order of Things Other Bits of Goodness Animating the Deltas ListAdapter. No, Not That ListAdapter. Expandable Rows RecyclerView as Pager Declaring a LayoutManager in the Layout Transcript Mode Advanced Uses of WebView Prerequisites Friends with Benefits Navigating the Waters Settings, Preferences, and Options (Oh, My!) Security and Your WebView
📄 Page
20
Android 8.0 WebView Changes Chrome Custom Tabs The Input Method Framework Prerequisites Keyboards, Hard and Soft Tailored To Your Needs Tell Android Where It Can Go Fitting In Jane, Stop This Crazy Thing! Fonts and Text Prerequisites Love The One You’re With Yeah, But Do We Really Have To Do This in Java? Here a Glyph, There a Glyph AutoSizing TextView Justified Text Rich Text Prerequisites The Span Concept Loading Rich Text Editing Rich Text Saving Rich Text Manipulating Rich Text Animators Prerequisites ViewPropertyAnimator The Foundation: Value and Object Animators Animating Custom Types Hardware Acceleration The Three-Fragment Problem Legacy Animations Prerequisites It’s Not Just For Toons Anymore A Quirky Translation Fading To Black. Or Some Other Color. When It’s All Said And Done Loose Fill Hit The Accelerator Animate. Set. Match.
The above is a preview of the first 20 pages. Register to read the complete e-book.
Recommended for You
Loading recommended books...
Failed to load, please try again later