Professional Documents
Culture Documents
(Download PDF) Elements of Android Jetpack Version 1 1 Mark L Murphy Online Ebook All Chapter PDF
(Download PDF) Elements of Android Jetpack Version 1 1 Mark L Murphy Online Ebook All Chapter PDF
1 Mark L. Murphy
Visit to download the full and correct content document:
https://textbookfull.com/product/elements-of-android-jetpack-version-1-1-mark-l-murp
hy/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...
https://textbookfull.com/product/android-s-architecture-
components-version-0-10-mark-l-murphy/
https://textbookfull.com/product/elements-of-kotlin-mark-l-
murphy/
https://textbookfull.com/product/the-busy-coder-s-guide-to-
android-development-8-1-mark-l-murphy/
https://textbookfull.com/product/android-studio-3-3-development-
essentials-android-9-edition-developing-android-9-apps-using-
android-studio-3-3-java-and-android-jetpack-neil-smyth/
Alexandrov geometry preliminary version no 1 Alexander
S.
https://textbookfull.com/product/alexandrov-geometry-preliminary-
version-no-1-alexander-s/
https://textbookfull.com/product/android-studio-iguana-
essentials-kotlin-edition-developing-android-apps-using-android-
studio-2023-2-1-and-kotlin-neil-smyth/
https://textbookfull.com/product/algebra-driven-design-elegant-
software-from-simple-building-blocks-version-1-1-2-sandy-maguire/
https://textbookfull.com/product/harrisons-principles-of-
internal-medicine-volume-1-chapters-1-98-dennis-l-kasper/
https://textbookfull.com/product/dungeons-and-dragon-ball-
mark-1-6-homebrew/
Elements of Android Jetpack
by Mark L. Murphy
Elements of Android Jetpack
by Mark L. Murphy
Printing History:
August 2020: Version 1.1
The CommonsWare name and logo, “Busy Coder's Guide”, and related trade dress are trademarks of CommonsWare,
LLC.
All other trademarks referenced in this book are trademarks of their respective firms.
The publisher and author(s) assume no responsibility for errors or omissions or for damages resulting from the use of the
information contained herein.
Table of Contents
Headings formatted in bold-italic have changed since the last version.
• Preface
◦ Prerequisites .......................................................................................... ix
◦ About the Updates ................................................................................ ix
◦ What’s New in Version 1.1? .......................................................... x
◦ Warescription ............................................................................. x
◦ Book Bug Bounty .................................................................................. xi
◦ Source Code and Its License .................................................... xii
◦ Creative Commons and the Four-to-Free (42F) Guarantee ..... xii
◦ Acknowledgments ............................................................................. xiii
• Introducing Android
◦ Focus: Apps, Not Operating Systems ................................................... 1
◦ What You Need ............................................................................ 1
◦ How This Book Is Organized ................................................................ 5
• Setting Up the Tools
◦ But First, Some Notes About Android’s Emulator .............................. 7
◦ Step #1: Install Android Studio ................................................... 8
◦ Step #2: Running Android Studio for the First Time ......................... 9
• Getting Your First Project
◦ Step #1: Importing the Project ................................................... 17
◦ Step #2: Get Ready for the x86 Emulator ........................................... 19
◦ Step #3: Set Up the AVD ...................................................................... 20
◦ Step #4: Set Up the Device .................................................................. 24
◦ Step #5: Running the Project .............................................................. 30
• Taking a Tour of Android Studio
◦ The Project Tree ................................................................................... 34
◦ The Editing Pane ................................................................................. 37
◦ The Docked Views ............................................................................... 37
◦ Popular Menu and Toolbar Options .................................................. 38
◦ Android Studio and Release Channels ............................................... 45
• Examining Your Code
◦ The Top Level ...................................................................................... 49
◦ The Project Contents ................................................................ 50
◦ The App Module Contents .................................................................. 52
◦ The Generated Source Sets ................................................................. 53
◦ Language Differences ............................................................... 57
i
◦ Introducing the Activity ........................................................... 57
◦ Other Things in the Project Tree ........................................................ 63
• Exploring Your Resources
◦ What You See in res/ .......................................................................... 66
◦ OS Versions and API Levels ............................................................... 66
◦ Decoding Resource Directory Names ............................................... 69
◦ Our Initial Resource Types ................................................................. 69
◦ About That R Thingy ................................................................ 75
◦ The Resource Manager ........................................................................ 76
• Inspecting Your Manifest
◦ The Root Element ................................................................................ 79
◦ The Application Element ................................................................... 80
◦ The Activity Element (And Its Children) ........................................... 81
• Reviewing Your Gradle Scripts
◦ Gradle: The Big Questions ........................................................ 83
◦ Obtaining Gradle ...................................................................... 85
◦ Examining the Gradle Files ...................................................... 87
◦ Requesting Plugins .............................................................................. 91
◦ Android Plugin for Gradle Configuration .......................................... 92
◦ Other Stuff in the android Closure ................................................... 94
◦ Libraries and Dependencies ..................................................... 94
• Inspecting the Compiled App
◦ What We Build .................................................................................... 97
◦ Where They Go ................................................................................... 99
◦ Building the APK ................................................................................ 99
◦ Analyzing the APK .................................................................. 100
• Touring the Tests
◦ Instrumented Tests .................................................................. 103
◦ Unit Tests .................................................................................. 111
• Introducing Jetpack
◦ What, Exactly, is Jetpack? .................................................................. 115
◦ Um, OK, So, What’s the Point? .......................................................... 115
◦ Key Elements of Jetpack ..................................................................... 116
◦ What Came Before: the Android Support Library ........................... 121
• Introducing the Sampler Projects
◦ The Projects ........................................................................................ 123
◦ Getting a Sampler Project ....................................................... 124
◦ The Modules ............................................................................. 127
◦ Running the Samples ............................................................... 127
• Starting Simple: TextView and Button
◦ First, Some Terminology .......................................................... 131
ii
◦ Introducing the Graphical Layout Editor ............................... 136
◦ TextView: Assigning Labels ..................................................... 144
◦ Button: Reacting to Input ....................................................... 150
◦ The Curious Case of the Missing R .................................................. 158
• Debugging Your App
◦ Get Thee To a Stack Trace ................................................................. 162
◦ Running Your App in the Debugger ................................................. 165
◦ So, Where Did We Go Wrong? .................................................. 171
• Introducing ConstraintLayout
◦ The Role of Containers ...................................................................... 176
◦ Layouts and Adapter-Based Containers ............................................ 177
◦ ConstraintLayout: One Layout To Rule Them All ........................... 178
◦ Getting ConstraintLayout ....................................................... 179
◦ Using Widgets and Containers from Libraries ................................ 179
◦ A Quick RTL Refresher ....................................................................... 181
◦ Simple Rows with ConstraintLayout ................................................ 182
◦ Starting from Scratch ........................................................................ 186
◦ ConstraintLayout and the Attributes Pane ...................................... 188
◦ EditText: Making Users Type Stuff ................................................... 189
◦ More Complex Forms ......................................................................... 191
◦ Turning Back to RTL .......................................................................... 198
◦ More Fun with ConstraintLayout ..................................................... 199
◦ Notes on the Classic Containers ...................................................... 200
• Integrating Common Form Widgets
◦ ImageView and ImageButton ................................................. 203
◦ Compound Buttons ................................................................. 209
◦ SeekBar ................................................................................................ 221
◦ ScrollView: Making It All Fit ............................................................. 224
◦ Other Notes About the Sample ................................................ 227
• Contemplating Contexts
◦ It’s Not an OMG Object, But It’s Close .................................... 235
◦ The Major Types of Context .................................................... 236
◦ Key Context Features ......................................................................... 238
◦ Know Your Context ........................................................................... 240
◦ Context Anti-Patterns ....................................................................... 241
• Icons
◦ App Icons… And Everything Else ...................................................... 243
◦ Creating an App Icon with the Asset Studio ................................... 244
◦ Creating Other Icons with the Asset Studio .................................... 250
• Adding Libraries
◦ Depending on a Local JAR ....................................................... 251
iii
◦ Artifacts and Repositories ....................................................... 252
◦ Requesting Dependencies ....................................................... 253
• Employing RecyclerView
◦ Recap: Layouts vs. Adapter-Based Containers ................................. 257
◦ The Challenge: Memory .................................................................... 258
◦ Enter RecyclerView ............................................................................ 259
◦ A Trivial List ............................................................................ 260
◦ Hey, What About ListView? .............................................................. 277
◦ Gesture Navigation and Scrolling Widgets ...................................... 277
• Coping with Configurations
◦ What’s a Configuration? And How Do They Change? .................... 281
◦ Configurations and Resource Sets ......................................... 282
◦ Implementing Resource Sets ................................................... 283
◦ Resource Set Rules .................................................................. 286
◦ Activity Lifecycles ................................................................... 290
◦ When Activities Die .......................................................................... 294
◦ Context Anti-Pattern: Outliving It ......................................... 295
• Integrating ViewModel
◦ Configuration Changes ...................................................................... 297
◦ What We Want… and What We Do Not Want .............................. 298
◦ Enter the ViewModel ........................................................................ 299
◦ Applying ViewModel ............................................................... 299
◦ ViewModel and the Lifecycle .................................................. 303
◦ Changing Data in the ViewModel .......................................... 308
◦ ViewModel and AndroidViewModel ................................................. 321
◦ ViewModelFactory ............................................................................. 322
• Understanding Processes
◦ When Processes Are Created ............................................................ 323
◦ What Is In Your Process .................................................................... 324
◦ BACK, HOME, and Your Process ...................................................... 324
◦ Termination ........................................................................................ 325
◦ Foreground Means “I Love You” ....................................................... 326
◦ Tasks and Your App ........................................................................... 327
◦ Instance State ..................................................................................... 329
◦ Pondering Parcelable ............................................................... 331
◦ A State-Aware ViewModel ........................................................ 337
• Binding Your Data (And Your Views)
◦ The Basic Steps ........................................................................ 345
◦ Why Bother? ...................................................................................... 357
◦ The View Binding Alternative .................................................. 358
• Defining and Using Styles
iv
◦ Styles: DIY DRY .................................................................................. 363
◦ Elements of Style ............................................................................... 364
◦ Themes: Would a Style By Any Other Name… ................................ 368
◦ Android 10 Dark Mode ...................................................................... 373
◦ The DayNight Solution ..................................................................... 377
◦ Context Anti-Pattern: Using Application Everywhere .................... 378
• Configuring the App Bar
◦ So. Many. Bars. ................................................................................... 382
◦ Vector Drawables ............................................................................... 384
◦ Menu Resources ................................................................................. 389
◦ Using Toolbar Directly ............................................................ 394
◦ Using Toolbar as the Action Bar ............................................. 407
◦ Having Fun at Bars ............................................................................ 410
• Implementing Multiple Activities
◦ Multiple Activities, and Your App ..................................................... 411
◦ Creating Your Second (and Third and…) Activity ........................... 412
◦ Starting Your Own Activity ............................................................... 414
◦ Extra! Extra! ........................................................................................ 415
◦ Seeing This In Action ............................................................... 415
◦ Using Implicit Intents ............................................................ 420
◦ Asynchronicity and Results .................................................... 422
◦ The Inverse: <intent-filter> ...................................................... 432
• Adopting Fragments
◦ The Six Questions .................................................................... 435
◦ Where You Get Your Fragments From ............................................ 440
◦ Static vs. Dynamic Fragments ......................................................... 440
◦ Fragments, and What You Have Seen Already ................................ 441
◦ ToDo, or Not ToDo? That Is the Question ............................... 441
◦ The Fragment Lifecycle Methods ............................................. 472
◦ Context Anti-Pattern: Assuming Certain Types .............................. 475
• Navigating Your App
◦ What We Get from the Navigation Component ............................. 477
◦ Elements of Navigation ..................................................................... 481
◦ A Navigation-ized To-Do List .................................................. 488
◦ So… Was It Worth It? ........................................................................ 500
• Dialogs
◦ A Tale of Four Dialogs ....................................................................... 501
◦ Using AlertDialog and DialogFragment ................................ 504
• Thinking About Threads and LiveData
◦ The Main Application Thread ........................................................... 513
◦ The UI Thread is for UI ...................................................................... 515
v
◦ Introducing LiveData ........................................................................ 516
◦ Colors… Live! ............................................................................ 518
◦ Sources of Owners ............................................................................. 525
◦ Where Do Threads Come From? Um, Besides From Me? .............. 526
◦ Coroutines and ViewModel ..................................................... 527
• Adding Some Architecture
◦ Repositories ............................................................................ 529
◦ Unidirectional Data Flow ....................................................... 530
◦ A UDF Implementation ........................................................... 532
◦ States and Events ..................................................................... 553
• Working with Content
◦ The Storage Access Framework ............................................... 561
• Using Preferences
◦ The Preferred Preferences ................................................................. 575
◦ Collecting Preferences with PreferenceFragmentCompat ..... 576
◦ Types of Preferences .......................................................................... 582
◦ Working with SharedPreferences ..................................................... 585
• Requesting Permissions
◦ Frequently-Asked Questions About Permissions ............................ 591
◦ Dangerous Permissions: Request at Runtime ........................ 594
• Handling Files
◦ The Three Types of File Storage ........................................................ 605
◦ What the User Sees .......................................................................... 608
◦ Storage, Permissions, and Access .................................................... 608
◦ Reading, Writing, and Debugging Storage ............................ 609
◦ Serving Files with FileProvider ............................................... 629
◦ What You Should Use ...................................................................... 640
• Accessing the Internet
◦ An API Roundup ....................................................................... 641
◦ Android’s Restrictions ....................................................................... 645
◦ Forecasting the Weather ........................................................ 647
• Storing Data in a Room
◦ Room Requirements ......................................................................... 668
◦ Room Furnishings ................................................................... 668
◦ Other Fun Stuff in the App ...................................................... 675
◦ What Else Does Room Offer? .................................................. 685
• Inverting Your Dependencies
◦ The Problem: Test Control ............................................................... 687
◦ The Solution: Dependency Inversion .............................................. 688
◦ Dependency Inversion in Android .................................................. 689
◦ Applying Koin ......................................................................... 689
vi
• Testing Your Changes
◦ A Quick Recap ................................................................................... 701
◦ Which Tests Should I Write? ............................................................ 702
◦ Writing Unit Tests ................................................................... 702
◦ Employing Mocks .................................................................... 708
◦ Writing Instrumented Tests .................................................... 716
◦ Writing Basic Espresso Tests ................................................... 722
◦ Another Option: UI Automator ........................................................ 728
◦ Again: What Should I Be Using? ...................................................... 729
• Working with WorkManager
◦ The Role of WorkManager ................................................................. 731
◦ WorkManager Dependencies ........................................................... 732
◦ Workers: They Do Work ........................................................... 733
◦ Performing Simple Work .................................................................. 736
◦ Work Inputs ....................................................................................... 737
◦ Constrained Work ............................................................................. 738
◦ Tagged Work ........................................................................... 739
◦ Monitoring Work .................................................................... 740
◦ Canceling Work ................................................................................. 748
◦ Delayed Work ..................................................................................... 749
◦ Parallel Work ...................................................................................... 749
◦ Chained Work ......................................................................... 750
◦ Periodic Work ................................................................................... 760
◦ Unique Work ..................................................................................... 760
◦ Testing Work ...................................................................................... 761
◦ WorkManager and Side Effects ......................................................... 764
• Creating a New Project
◦ Key Decisions That You Need to Make ........................................... 769
◦ The New-Project Wizard ................................................................... 772
◦ Copying an Existing Project .............................................................. 777
• Signing Your App
◦ Role of Code Signing ......................................................................... 779
◦ What Happens In Debug Mode ........................................................ 780
◦ Production Signing Keys ................................................................... 781
• Shrinking Your App
◦ Why We Care .................................................................................... 789
◦ Identify What to Attack ................................................................... 790
◦ Shrinking Your Dependencies ................................................ 790
◦ Shrinking Your Code ......................................................................... 792
◦ Removing Unused Resources ........................................................... 796
◦ Optimizing Bitmaps .......................................................................... 798
vii
◦ Hey, What About App Bundles? ....................................................... 803
• Using the AVD Manager and the Emulator
◦ Notable AVD Configuration Options ............................................... 805
◦ The Emulator Sidebar ........................................................................ 811
◦ Emulator Window Operations ......................................................... 827
• Using the SDK Manager
◦ Installing Platform Pieces ................................................................. 830
◦ Installing and Upgrading Tools ........................................................ 832
◦ Adding Third-Party SDK Suppliers .................................................. 833
• Configuring Your Project
◦ Risks and Rewards ............................................................................. 835
◦ The Project Category ......................................................................... 836
◦ The SDK Location .............................................................................. 837
◦ The Variables ...................................................................................... 838
◦ The Modules ...................................................................................... 839
◦ Dependencies ..................................................................................... 843
◦ Build Variants .................................................................................... 844
◦ Suggestions ....................................................................................... 846
• Configuring Android Studio
◦ Searching for Settings ....................................................................... 848
◦ Themes and Colors ........................................................................... 849
◦ Fonts. And Other Fonts. .................................................................... 851
◦ Code Styles ......................................................................................... 855
◦ Inlay Hints .............................................................................. 860
◦ Other Settings of Note ...................................................................... 862
• Coping with New Android Versions
◦ The March of the Versions ................................................................ 865
◦ The Typical Release Process ............................................................. 866
◦ Things to Worry About .................................................................... 868
• Deciding Where to Go From Here
◦ The Rest of the Books ........................................................................ 871
◦ Android Developer Support .................................................... 872
◦ Major Conferences .................................................................. 872
viii
Preface
Thanks!
Thanks for your interest in developing applications for Android! Android has grown
from nothing to the world’s most popular smartphone OS in a few short years.
Whether you are developing applications for the public, for your business or
organization, or are just experimenting on your own, I think you will find Android to
be an exciting and challenging area for exploration.
And, most of all, thanks for your interest in this book! I sincerely hope you find it
useful and at least occasionally entertaining.
Prerequisites
This book is written for developers with prior experience in Java or Kotlin. If you are
not familiar with either of these languages, it will be difficult for you to follow the
code samples in the book. The author of this book has published Elements of Kotlin.
If you obtained this book via the Warescription, you are eligible to download a copy
of Elements of Kotlin, along with the rest of the CommonsWare line of books.
This book is written for people who have used an Android device before. If you are
not familiar with basic Android concepts — such as the home screen and launcher,
the HOME button, the BACK button, and so on — you will want to spend time with
an Android device.
ix
PREFACE
If you obtained this book through the Warescription, you will be able to download
updates as they become available, for the duration of your subscription period.
If you obtained this book through other channels… um, well, it’s still a really nice
book!
Each release has notations to show what is new or changed compared with the
immediately preceding release:
And, there is the “What’s New” section, just below this paragraph.
In addition:
• The Room Kotlin sample was updated to have its DAO use Flow instead of
LiveData
• Manual uses of SavedStateViewModelFactory were removed, as that is now
handled directly by the viewmodel libraries
• Some samples were updated to use Java 8 time classes (notably Instant),
with an explanation of how to enable the “desugaring” so those classes can
be used on older devices
• FrameLayout was replaced by FragmentContainerView in a few samples
• Many dependencies were updated throughout the app
And, as always, there were a variety of bug fixes and minor improvements.
Warescription
If you purchased the Warescription, read on! If you obtained this book from other
channels, feel free to jump ahead.
x
PREFACE
The Warescription entitles you, for the duration of your subscription, to digital
editions of this book and its updates, in PDF, EPUB, and Kindle (MOBI/KF8)
formats, plus the ability to read the book online at the Warescription Web site. You
also have access to other books that CommonsWare publishes during that
subscription period.
Each subscriber gets personalized editions of all editions of each title. That way,
your books are never out of date for long, and you can take advantage of new
material as it is made available.
However, you can only download the books while you have an active Warescription.
Hence, please download your updates as they come out. You can find out when
new releases of this book are available via:
1. The CommonsBlog
2. The CommonsWare Twitter feed
3. Opting into emails announcing each book release — log into the
Warescription site and choose Configure from the nav bar
4. Just check back on the Warescription site every month or two
• “Office hours” — online chats to help you get answers to your Android
application development questions. You will find a calendar for these on
your Warescription page.
• A Stack Overflow “bump” service, to get additional attention for a question
that you have posted there that does not have an adequate answer.
• A discussion board for asking arbitrary questions about Android app
development.
Be the first to report a unique concrete problem in the current edition, and
CommonsWare will extend your Warescription by six months as a bounty for
helping CommonsWare deliver a better product.
xi
PREFACE
1. Typographical errors
2. Sample applications that do not work as advertised, in the environment
described in the book
3. Factual errors that cannot be open to interpretation
By “unique”, we mean ones not yet reported. Be sure to check the book’s errata page,
though, to see if your issue has already been reported. One coupon is given per
email containing valid bug reports.
• Places where you think we are in error, but where we feel our interpretation
is reasonable
• Places where you think we could add sample applications, or otherwise
expand upon the existing material
However, those “softer” issues do not qualify for the formal bounty program.
Questions about the bug bounty, or problems you wish to report for bounty
consideration, should be sent to bounty@commonsware.com.
Copying source code directly from the book, in the PDF editions, works best with
Adobe Reader, though it may also work with other PDF viewers. Some PDF viewers,
for reasons that remain unclear, foul up copying the source code to the clipboard
when it is selected.
xii
PREFACE
This edition of this book will be available under the aforementioned Creative
Commons license on 1 August 2024.
Note that future editions of this book will become free on later dates, each four years
from the publication of that edition. Releasing one edition under the Creative
Commons license does not automatically release all editions under that license.
Acknowledgments
The author would like to thank the Google team responsible for Android and the
Android Jetpack.
xiii
SETTING UP THE TOOLS
If you are using Android Studio for the first time, the “Do not import settings”
option is the correct choice to make.
Then, after a short splash screen, you may be presented with a “Data Sharing”
dialog:
10
Another random document with
no related content on Scribd:
The Project Gutenberg eBook of Left hand, right
hand
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Language: English
By JAMES H. SCHMITZ
Illustrated by SCHELLING
Men were tortured ... men were killed ... and the Earth
Scientists chatted pleasantly with the Tareeg. Were
they traitors or were they waiting for The Ice Men?
"Try to stay awake, Jerry! There're just a few other things you should
try to get nailed down in your memory this time. The Hammerheads
are water animals. They can waddle around on land as long as they
keep themselves moist, but they don't like it. They've got a religion
based on a universal struggle between water and land. Cassa One's
nothing but hot desert and rock and big salt beds, so it's no good to
them. And the other two planets in the system have no oxygen to
speak of.
"Now here's the thing that's hard to swallow. There's a huge lumped-
up asteroid swarm in the system. The Atlas stopped for a few days
on the way in to look around in it. Dexter and Clingman, after we'd
been captured, volunteered the information to the Hammerheads
that a lot of that stuff was solid H2O and that if they wanted Cassa
One fixed up the way they'd like it—wet—the Atlas could ferry
enough asteroid ice over here in billion-ton loads to turn most of the
surface of the planet into a sea.
"You understand it wasn't the Hammerheads who had the idea. They
don't have anything resembling the ship power and equipment to
handle such a job; it hadn't even occurred to them that it could be
possible. But you can bet they bought it when it was handed to them.
It will give them a base a third of the way between their own system
and Sol. That's what's been going on since we landed and were
grabbed off ... almost three years ago now.
"And these last weeks there've been, for the first time since we got
here, a few clouds in the sky. It means the boys on the Atlas have as
many of those mountains of ice riding on orbit as are needed, and
they've started shoving them down into the atmosphere to break up
and melt. So we ... Jerry, wake up!"
Where were they going? They were carrying the usual weapons, but
this was not some dryland drill. Troy could not remember seeing so
large a group leave the station before. The uneasy conviction
returned that the move must be connected with the fact that clouds
had begun to show in Cassa One's skies, that the mile-thick
boulders of ice which had been brought across space already were
falling through the atmosphere of the desiccated world.
One or two more undisturbed days, Troy thought. In that time it
would become clear whether Newland was going to recover
sufficiently to be able to play a part in his plans. Only two sections of
the shattered courier ship, the inertial shielding and the autonav, had
been needed to transform the Hammerheads' interstellar drone
twenty feet from the tunnel exit into a spaceship which men could
ride and direct. Both those sections had been repairable, and
everything else Troy had been able to steal or build in the station.
Month after month passed as he brought it all together in the tunnel,
familiarized himself with every necessary detail of the drones'
mechanisms and fitted in the new installations ... first in theory, then
in actual fact. A part of almost every night was spent in the darkened
hangar, assembling, checking and testing one section or another,
then disassembling everything and taking it back down into the
tunnel before the moment came when the Tareeg watch-beams
would sweep again through the hangar.
The beam-search was repeated each three hours and twenty-seven
minutes throughout the night. Within that period of time, Troy would
have to carry out a final complete assembly, let the drone roar into
life and send it flashing up through the force-screen and into space.
By now, he knew he could do it. And if he had calculated the drone's
capacity correctly, he would then be less than six months from Earth.
The Hammerheads had nothing they could send after him.
But once in space, he needed Newland's experience. Everything
else would be on board to get them to Earth, but without a trained
pilot the probability of arriving only on autonav was something Troy
couldn't calculate. With a great deal of luck, he thought, it still should
be possible. Newland's skills, on the other hand, would give them
something considerably better than an even chance.
But Newland would have to be recovered first. He was still under the
ministrations of the emergency tank, embedded now in the wall of
the back room beyond the bunk. The tank had to stay there; no
amount of planning had shown a way it could be fitted into the drone
besides everything else; there simply was no room left for it. And
what Troy had learned made it clear that if he lifted into space with
Newland before the pilot's behavior was very nearly normal, he
would have a half-dead zombie on his hands before the trip was well
begun.
That had been his reason for waiting. But the question was now
whether he mightn't already have waited a little too long....
Troy checked his watch. Take a chance and begin the final
installation at once? It would be an hour before the search-beams
came back. The interior of the ships was inspected at irregular
periods; he hadn't been able to establish any pattern for that. But to
leave his equipment in place in the drone for one day, or two at the
most, might not be stretching his luck too far. Then, if Newland
shaped up, there would be that much less delay in leaving, that
much less time to spend in the Tareeg hangar finishing the job at the
end. And no one could tell what new developments the next few
days might bring, or how much time they would find that they had
left....
He twisted the direction dials on the vision screen, swinging it slowly
once more about the darkened hangar. Then he unlocked and
shifted the exit switch, and the irregularly carved section of rock
above him moved on its lifting rods out of the hangar floor. Troy
swung up and out behind it, got to his feet and started over to the
drone.
There was a thin, burring noise close to his ear.
Troy stopped in mid-stride, his face tight and wary. The noise meant
that his room communicator was being called. Probably some minor
technical emergency on the station, but.... He counted off twenty
seconds, then turned on the relay mike under his coat collar. Trying
to make his voice thick with drowsiness, he said, "Gordon speaking.
Who's it?"
"Reese," a carefully uninflected voice told him from the speaker. "Dr.
Clingman wants you to come up to his office immediately, Gordon."
Troy felt a sudden sharp prickling of fear.
"At this time of night?" he demanded petulantly. "It's the middle of my
sleep period! What's gone wrong now?"
"I wouldn't know," Reese said. "Our senior scientist"—he made the
two words sound like a worn, habitual curse—"didn't go into details."