100% found this document useful (1 vote)
6 views

Asynchronous Android Programming Helder Vasconcelos download

The document is a promotional and informational piece about the book 'Asynchronous Android Programming' by Helder Vasconcelos, which focuses on building responsive Android applications using asynchronous programming techniques. It highlights the author's background, the book's content structure, and various chapters that cover topics such as the Android process model, concurrency, and specific programming constructs like AsyncTask and JobScheduler. Additionally, it provides links to download the book and other related resources on asynchronous programming in different programming languages.

Uploaded by

kulykregusoy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
6 views

Asynchronous Android Programming Helder Vasconcelos download

The document is a promotional and informational piece about the book 'Asynchronous Android Programming' by Helder Vasconcelos, which focuses on building responsive Android applications using asynchronous programming techniques. It highlights the author's background, the book's content structure, and various chapters that cover topics such as the Android process model, concurrency, and specific programming constructs like AsyncTask and JobScheduler. Additionally, it provides links to download the book and other related resources on asynchronous programming in different programming languages.

Uploaded by

kulykregusoy
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

Asynchronous Android Programming Helder

Vasconcelos download

https://textbookfull.com/product/asynchronous-android-
programming-helder-vasconcelos/

Download more ebook from https://textbookfull.com


We believe these products will be a great fit for you. Click
the link to download now, or visit textbookfull.com
to discover even more!

Asynchronous Programming in Rust: Learn asynchronous


programming by building working examples of futures,
green threads, and runtimes 1st Edition Carl Fredrik
Samson
https://textbookfull.com/product/asynchronous-programming-in-
rust-learn-asynchronous-programming-by-building-working-examples-
of-futures-green-threads-and-runtimes-1st-edition-carl-fredrik-
samson/

Combine Asynchronous Programming with Swift First


Edition Scott Gardner

https://textbookfull.com/product/combine-asynchronous-
programming-with-swift-first-edition-scott-gardner/

Combine Asynchronous Programming with Swift First


Edition Scott Gardner

https://textbookfull.com/product/combine-asynchronous-
programming-with-swift-first-edition-scott-gardner-2/

Asynchronous Programming in Rust 1st Edition Carl


Fredrik Samson

https://textbookfull.com/product/asynchronous-programming-in-
rust-1st-edition-carl-fredrik-samson/
Asynchronous Programming in Rust 1 / converted Edition
Carl Fredrik Samson

https://textbookfull.com/product/asynchronous-programming-in-
rust-1-converted-edition-carl-fredrik-samson/

Using Asyncio in Python Understanding Python s


Asynchronous Programming Features Caleb Hattingh

https://textbookfull.com/product/using-asyncio-in-python-
understanding-python-s-asynchronous-programming-features-caleb-
hattingh/

Learning embedded Android N programming 1st Edition


Ivan Morgillo

https://textbookfull.com/product/learning-embedded-android-n-
programming-1st-edition-ivan-morgillo/

Expert Twisted: Event-Driven and Asynchronous


Programming with Python 1st Edition Mark Williams

https://textbookfull.com/product/expert-twisted-event-driven-and-
asynchronous-programming-with-python-1st-edition-mark-williams/

Concurrency in C Cookbook Asynchronous Parallel and


Multithreaded Programming 2nd Edition Stephen Cleary

https://textbookfull.com/product/concurrency-in-c-cookbook-
asynchronous-parallel-and-multithreaded-programming-2nd-edition-
stephen-cleary/
[1]
Asynchronous Android
Programming
Second Edition

Unlock the power of multi-core mobile devices to build


responsive and reactive Android applications

Helder Vasconcelos

BIRMINGHAM - MUMBAI
Asynchronous Android Programming
Second Edition

Copyright © 2016 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.

First published: July 2016

Production reference: 1260716

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

ISBN 978-1-78588-324-8

www.packtpub.com
Credits

Author Project Coordinator


Helder Vasconcelos Nidhi Joshi

Reviewer Proofreader
Gavin Matthews Safis Editing

Commissioning Editor Indexer


Edward Gordon Mariammal Chettiyar

Acquisition Editor Graphics


Indrajit Das Disha Haria

Content Development Editor Production Coordinator


Siddhesh Salvi Arvindkumar Gupta

Technical Editor Cover Work


Danish Shaikh Arvindkumar Gupta

Copy Editor
Vibha Shukla
About the Author

Helder Vasconcelos is a Portuguese Software Engineer based on Dublin,


Ireland, with more than 10 years of experience designing and developing
real-time/multithreaded Java and C++ applications for the telecommunications
and aviation industries. Apart from his day-to-day job, he occupies his spare
time building native Android applications for Bearstouch Software and
other third-party companies.

He graduated with a degree in Electronic and Telecommunications Engineering


from the University of Aveiro in January 2006. During his career, he has worked
as a Software Engineer for companies such as PT Inovação (Portugal), Airtel ATN
(Dublin, Ireland) and Axway (Dublin, Ireland). You can find Hélder on LinkedIn
at (https://ie.linkedin.com/in/heldervasc/en) or on his website at
(http://hvasconcelos.github.io).

I would like to sincerely thanks all technical reviewers, but especially


Gavin. I really appreciate your invaluable feedback and commit that
shaped the quality of the book. A special thanks to my awesome wife
Tania for encourage me when the lack of motivation was killing my
productivity. It would not have been possible without your precious
support. Thanks also to my parents and family for their awesome
effort in my education. Additionally, I would like to thank my
friends, colleagues, clients, and teachers for helping me to shape and
improve my skills and perspectives during my career.
About the Reviewer

Gavin Matthews is a veteran software engineer specializing in enterprise scale


B2B, MFT and EFSS systems.
www.PacktPub.com

eBooks, discount offers, and more


Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.
com and as a print book customer, you are entitled to a discount on the eBook copy.
Get in touch with us at customercare@packtpub.com for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.
TM

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser
Table of Contents
Preface vii
Chapter 1: Asynchronous Programming in Android 1
Android software stack 2
Dalvik runtime 2
ART runtime 3
Memory sharing and Zygote 4
Android process model 5
Process ranks 5
Process sandboxing 6
Android thread model 6
The main thread 7
The Application Not Responding (ANR) dialog 9
Maintaining responsiveness 10
Concurrency in Android 12
Correctness issues in concurrent programs 14
Liveness issues in concurrent programs 16
Thread coordination 16
Concurrent package constructs 19
Executor framework 20
Android primary building blocks 21
Activity concurrent issues 21
Manipulating the user interface 23
Service concurrent issues 25
Started services issues 25
Bound services issues 26
Service in a separate process 27
Broadcast receiver concurrent issues 28
Android concurrency constructs 28
Summary 29
[i]
Table of Contents

Chapter 2: Performing Work with Looper, Handler,


and HandlerThread 31
Understanding Looper 32
Understanding Handler 34
Sending work to a Looper 37
Scheduling work with post 39
Using Handler to defer work 40
Leaking implicit references 41
Leaking explicit references 43
Updating the UI with Handler 45
Canceling a pending Runnable 46
Scheduling work with send 47
Cancelling pending messages 50
Composition versus inheritance 52
Multithreading with Handler and ThreadHandler 53
Looper message dispatching debugging 58
Sending messages versus posting runnables 59
Applications of Handler and HandlerThread 59
Summary 60
Chapter 3: Exploring the AsyncTask 61
Introducing AsyncTask 62
Declaring AsyncTask types 65
Executing AsyncTasks 67
Providing indeterministic progress feedback 69
Providing deterministic progress feedback 72
Canceling an AsyncTask 75
AsyncTask Execution State 78
Handling exceptions 79
Controlling the level of concurrency 81
Common AsyncTask issues 84
Fragmentation issues 84
Memory leaks 85
Activity lifecycle issues 85
Handling lifecycle issues with early cancellation 86
Handling lifecycle issues with retained headless fragments 87
Applications of AsyncTask 92
Summary 93
Chapter 4: Exploring the Loader 95
Introducing Loaders 96
Loader API 96
Loader 97

[ ii ]
Table of Contents

Loader Manager 98
LoaderManager.LoaderCallbacks 99
Loader lifecycle 100
Loading data with Loader 101
Building responsive apps with AsyncTaskLoader 107
Building responsive apps with CursorLoader 116
Combining Loaders 119
Applications of Loader 125
Summary 125
Chapter 5: Interacting with Services 127
Introducing Service 128
Started service 131
Building responsive apps with IntentService 136
Handling results 139
Posting results with PendingIntent 139
Posting results as system notifications 142
Applications of IntentService 143
HTTP uploads with IntentService 144
Reporting progress 146
Bound Service 149
Communicating with a Local Service 150
Broadcasting results with intents 158
Detecting unhandled broadcasts 160
Applications of Services 163
Summary 164
Chapter 6: Scheduling Work with AlarmManager 165
Introducing AlarmManager 166
Scheduling alarms with AlarmManager 167
Setting alarms in recent Android versions 169
Testing your alarms in Doze Mode 172
Setting a Window alarm 173
Debugging AlarmManager alarms 173
Canceling alarms 175
Scheduling repeating alarms 176
Scheduling an alarm clock 178
Handling alarms 179
Handling alarms with Activities 180
Handling alarms with BroadcastReceiver 181
Working with BroadcastReceiver 183
Asynchronous work with goAsync 186

[ iii ]
Table of Contents

Handling alarms with Services 187


Staying awake with WakeLocks 188
Resetting alarms after a system reboot 190
Applications of AlarmManager 192
Summary 192
Chapter 7: Exploring the JobScheduler API 195
Introduction to JobScheduler 196
Setting running criteria 197
Scheduling a job 200
Implementing the JobService 203
Listing pending jobs 208
Canceling a job 211
Scheduling a periodic job 211
Applications of the JobScheduler 212
Summary 213
Chapter 8: Interacting with the Network 215
Introducing Android HTTP clients 216
AndroidHttpClient 217
HttpURLConnection 218
Performing HTTP requests asynchronously 218
Retrieving a text response 225
Interacting with JSON web APIs 227
Converting Java objects to JSON 228
Interacting with XML web APIs 234
Converting Java objects to XML 235
Converting XML to Java objects 237
Customizing HTTP timeouts 241
Communicating securely over SSL sessions 243
Summary 251
Chapter 9: Asynchronous Work on the Native Layer 253
Introduction to JNI 254
Android NDK (Native Development Kit) 255
Calling C functions from Java code 256
Calling C++ functions from native code 260
Accessing Java objects from native code 262
Executing native background work on Java threads 265
Executing asynchronous work on a native thread 270
Attaching and detaching native threads from JVM 270
JNI references explained 276
Interacting with UI from native threads 277

[ iv ]
Table of Contents

Starting the native threads 279


Stopping the native threads 279
Handling Java exceptions in the native layer 280
Interacting with a Java monitor from native code 283
Wrapping native data objects 287
Summary 291
Chapter 10: Network Interactions with GCM 293
Introduction to GCM 294
Setting up and configuring GCM for your application 296
Registering the GCM Receiver 298
Setting up a registration service 298
InstanceID listener 300
Receiving downstream messages 302
Receiving messages from topic 306
Sending upstream messages 310
GcmListenerService delivery callbacks 314
Executing tasks with GCM Network Manager 315
Building a one shot task 316
Summary 320
Chapter 11: Exploring Bus-based Communications 321
Introduction to bus-based communication 322
EventBus library 323
Defining events 324
Submitting events 325
Registering sbscribers 326
Thread mode 327
Posting sticking events 334
Removing sticky events 338
Summary 339
Chapter 12: Asynchronous Programing with RxJava 341
Introduction to RxJava 342
Cold versus Hot Observable 344
RxJava setup 344
Creating Observables 344
Transforming Observables 347
Understanding Schedulers 349
Performing IO operations with Schedulers 351
Canceling subscriptions 354
Composing Observables 354
Monitoring the event stream 356

[v]
Table of Contents

Combining Observables 359


Observing UI Events with RxJava 362
Working with Subjects 366
Summary 369
Index 371

[ vi ]
Preface
Whether you are Android beginner developer or an Android seasoned programmer,
this book will explore how to achieve efficient and reliable multithreaded Android
applications.

We'll look at best asynchronous constructs and techniques, commonly used by


Android Developer community, to execute computation intensive or blocking tasks
off the main thread, keeping the UI responsive, telling the user how things are going,
making sure we finish what we started, using those powerful multicore processors,
and doing it all without wasting the battery.

By using the right asynchronous construct, much of the complexity is abstracted


from the developer, making the application source code more readable and
maintainable and less error prone.

Using step-by-step guidelines and code examples, you will learn how manage
interactions between several threads and avoid concurrency and synchronization
problems that might occur when two or more threads access a shared resource to
complete a background job, to update the UI or retrieve the latest application data.

At the end of this journey you will know how build well-behaved applications with
smooth, responsive user-interfaces that delight users with speedy results and data
that's always fresh.

What this book covers


Chapter 1, Asynchronous Programming in Android, gives an overview of the Android
process and thread model, and describes some of the challenges and benefits of
concurrency in general, before discussing issues specific to Android.

[ vii ]
Preface

Chapter 2, Performing Work with Looper, Handler and HandlerThread details the
fundamental and related topics of Handler, HandlerThread, and Looper, and
illustrates how they can be used to schedule tasks on the main thread, and to
coordinate and communicate work between cooperating background threads.

Chapter 3, Exploring the AsyncTask, covers the most common concurrent construct of
programming in Android. We learn how AsyncTask works, how to use it correctly,
and how to avoid the common pitfalls that catch out even experienced developers.

Chapter 4, Exploring the Loader, introduces the Loader framework and tackles the
important task of loading data asynchronously to keep the user interface responsive
and glitch free.

Chapter 5, Interacting with Services, we explored the very powerful Service Android
component, putting it to use to execute long-running background tasks with or
without a configurable level of concurrency. This component gives us the means to
perform background operations beyond the scope of a single Activity lifecycle and
to ensure that our work is completed even if the user leaves the application.

Chapter 6, Scheduling Work with AlarmManager, introduces to us a system API that


could be used to defer work or create periodic tasks. The scheduled task could wake
up the device to complete the work or alert users to new content.

Chapter 7, Exploring the JobScheduler API, covers a job scheduling system API
introduced with Android Lollipop that allows us to start background work
when a set of device conditions, such as energy or network, are fulfilled.

Chapter 8, Interacting with the Network, we cover in detail HttpUrlConnection


Android HTTP client. With the HttpUrlConnection HTTP client, we will create
an asynchronous toolkit that is able to fetch JSON documents, XML or text from a
remote server.

Chapter 9, Asynchronous Work on the Native layer, introduces the JNI interface, an
Java standard interface that will allow us to execute concurrent tasks on native
code (C/C++), interact with the Java code from the native layer or update the
UI from the native code.

Chapter 10, Network Interactions with GCM, we will learn how to use the Google GCM
to efficiently push and pull efficiently realtime messages from your server and how
to schedule work with Google Play Services framework.

Chapter 11, Exploring Bus-based Communications, we will introduce to the reader the
publish-subscribe messaging pattern and the Event Bus Library, a publish-subscribe
implementation that allow us to deliver asynchronous messages between Android
application components.

[ viii ]
Preface

Chapter 12, Asynchronous Programing with RxJava, we will introduce RxJava, a library
used to easily compose asynchronous and event-based tasks on Java by using
observable data streams.

What you need for this book


To follow along and experiment with the examples, you will need a development
computer with a Java 7 (or 8) SE Development Kit and the Android Software
Development Kit Version 9 or above (you will need at least Version 21 to try all of
the examples).

You will also need Android Studio IDE. The examples have been developed using
Google's new Android Studio IDE and use its integrated build system, Gradle.

While you can run the examples using the emulator provided by the Android SDK, it
is a poor substitute for the real thing. A physical Android device is a much faster and
more pleasurable way to develop and test Android applications!

Many of the examples will work on a device running any version of Android since
2.3, GingerBread. Some examples demonstrate newer APIs and as a result, require a
more recent Android version—up to Android 5, Lollipop.

Who this book is for


This book is for Android Developers who want to learn how to build multithreaded
and reliable Android applications using high level and advanced asynchronous
techniques and concepts.

They want to learn this technology because they want learn how to build efficient
applications that are able to interact orderly with internal/external services and
frameworks using Android standard constructs and APIs.

No prior knowledge of of concurrent and asynchronous programming is required.


This book is also targeted towards Java experts who are new to Android.

Conventions
In this book, you will find a number of text styles that distinguish between different
kinds of information. Here are some examples of these styles and an explanation of
their meaning.

[ ix ]
Preface

Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
"We can include other contexts through the use of the include directive."

A block of code is set as follows:


[default]
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)

When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
[default]
exten => s,1,Dial(Zap/1|30)
exten => s,2,Voicemail(u100)
exten => s,102,Voicemail(b100)
exten => i,1,Voicemail(s0)

Any command-line input or output is written as follows:


# cp /usr/src/asterisk-addons/configs/cdr_mysql.conf.sample
/etc/asterisk/cdr_mysql.conf

New terms and important words are shown in bold. Words that you see on the
screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking
the Next button moves you to the next screen."

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it helps
us develop titles that you will really get the most out of.

[x]
Preface

To send us general feedback, simply e-mail feedback@packtpub.com, and mention


the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.

Downloading the example code


You can download the example code files for this book from your account at
http://www.packtpub.com. If you purchased this book elsewhere, you can visit
http://www.packtpub.com/support and register to have the files e-mailed directly
to you.

You can download the code files by following these steps:

1. Log in or register to our website using your e-mail address and password.
2. Hover the mouse pointer on the SUPPORT tab at the top.
3. Click on Code Downloads & Errata.
4. Enter the name of the book in the Search box.
5. Select the book for which you're looking to download the code files.
6. Choose from the drop-down menu where you purchased this book from.
7. Click on Code Download.

You can also download the code files by clicking on the Code Files button on the
book's webpage at the Packt Publishing website. This page can be accessed by
entering the book's name in the Search box. Please note that you need to be logged in
to your Packt account.

Once the file is downloaded, please make sure that you unzip or extract the folder
using the latest version of:

• WinRAR / 7-Zip for Windows


• Zipeg / iZip / UnRarX for Mac
• 7-Zip / PeaZip for Linux

[ xi ]
Preface

The code bundle for the book is also hosted on GitHub at https://github.com/
PacktPublishing/Asynchronous-Android-Programming. We also have other code
bundles from our rich catalog of books and videos available at https://github.
com/PacktPublishing/. Check them out!

Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you could report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our website or added
to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/


content/support and enter the name of the book in the search field. The required
information will appear under the Errata section.

Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.

Please contact us at copyright@packtpub.com with a link to the suspected


pirated material.

We appreciate your help in protecting our authors and our ability to bring you
valuable content.

Questions
If you have a problem with any aspect of this book, you can contact us at
questions@packtpub.com, and we will do our best to address the problem.

[ xii ]
Asynchronous Programming
in Android
Asynchronous programming has become an important topic of discussion in the past
few years, especially when using the concurrent processing capabilities available on
the most recent mobile hardware.

In recent years, the number of independent processing units (cores) available on


the CPU have increased, so to benefit from this new processing power, a new
programming model called asynchronous programming has appeared to orchestrate
the work between the several independent hardware-processing units available on
the device. Asynchronous programming comes to the rescue to solve the problems
that could arise from this new processing paradigm.

Android applications, since they mostly run on devices with multiple units of
processing, should take advantage of asynchronous programming to scale and
improve the application performance when blocking operations, and when
CPU-intensive tasks are required.

Android is an open source operating system (OS) based on Linux kernel that was
devised in 2003 by Andy Rubin, Nick Sears, Chris White, and Rick Miner, and then
acquired by Google in July, 2005.

The Android OS, actually maintained by Google and the Open Handset Alliance,
was created to provide an open mobile-device platform for devices with limited
resources of computation, memory, and energy.

The platform has been incorporating advanced mobile devices standards, such as
NFC and Bluetooth LE, and its scope has grown from a pure smartphone platform to
a broader software platform for smart watches, TVs, tablets, and consoles.

[1]
Asynchronous Programming in Android

The maintainers have been regularly updating the platform with great features and
some improvements over minor and major releases since the first release.

The following diagram displays the Android versions over time:

Android software stack


Android software stack (C libraries and Java frameworks), orchestrated by the
Android runtime (Dalvik VM, and most recently, ART) was created around the
Linux kernel to provide highly interactive user experiences over a well-proven
group of technologies.

In each new OS version, a well-defined application interface (API) is provided to


the developer in order to create applications around the new features and standards
introduced with the release.

The Android application compiled code (bytecode), typically a Java compiled code,
runs on a virtual machine based on Dalvik or ART.

Dalvik runtime
The Dalvik VM (DVM) runtime, created by Dan Borstein, was the first runtime for
the platform and is a register-based virtual machine that was created to run the Java
code efficiently in a constrained runtime with a limited amount of power processing,
RAM, and electric power.

[2]
Chapter 1

Dalvik's creators claim that the DVM is, on an average, around 30% more efficient
than the standard Java VM (Oracle). According to Bornstein, it requires 30% less
instructions and 35 % less coding units.

Clearly, Google has gone to great lengths to squeeze every drop of performance out
of each mobile device to help developers build responsive applications.

The virtual machine, which runs the Java code compiled and transformed to the dex
format over the dx tool, runs on a Linux process with its own memory space and file
descriptors. It also manages its own group of threads.

In more advanced architectures, an Android application might run a service in a


separate process and communicate over the IPC mechanism, but most of the time, it
runs on a single self-contained process.

The dex file and application resources are packed in an Android application
package (APK) by the AAPT and installed over Google Play in the end user devices.

The application store distribution model has become


extremely popular on the mobile platforms since the launch
of the Apple iPhone in 2007.

Since Android 2.2 the DVM comes with a trace-based Just-In-Time (JIT) compilation
feature that actively optimizes every time the application runs some short segments
of frequently used bytecode called traces.

The generated machine code provides significant performance improvements in


the application execution and on the time spent on some intensive CPU tasks, and
thereafter, decreases the battery power used.

ART runtime
The ART runtime is a new version of the DVM and was introduced to improve the
runtime performance and memory consumption. The new runtime was introduced
in Android 4.4 KitKat as an experimental runtime, and since the Android 5.0
Lollipop, it has become the main Android runtime.

This new runtime, making use of the ahead-of-time (AOT) compilation, brings new
app-performance optimizations on startup time and application execution. The AOT,
as opposed to DVM JIT (Just in Time), compiles the dex files during the installation
time using the device dex2oat tool. The compiled code generated from the dex2oat
tool generates system-dependent code for the target device and removes the delay
introduced by the JIT compilation during each application execution.

[3]
Asynchronous Programming in Android

The AOT compiler also reduces the number of processor cycles used by the
application as it removes the time spent by the JIT compiler to convert the
code into machine code, and then uses less battery power to run the application.

One of the drawbacks of the AOT compilation is the larger memory footprint in
comparison with the JIT used by DVM.

With the new runtime, some improvements were also introduced in the memory
allocation and on Garbage Collection (GC), resulting in a more responsive UI and
better application experience.

Memory sharing and Zygote


Basically, the platform runs an instance of DVM/ART for each application, but large
optimization of the platform is brought about by the way a new DVM instance is
created and managed.

A special process called the Zygote (first life cell in an animal's reproduction)—
the process that all the Android applications are based on—is launched when an
Android device initially boots.

The Zygote starts up a virtual machine, preloads the core libraries, and initializes
various shared structures. It then waits for instructions by listening on a socket.

When a new Android application is launched, the Zygote receives a command


to create a virtual machine to run the application on. It does this by forking its
pre-warmed VM process and creating a new child process that shares some
memory portions with the parent, using a technique called copy-on-write (COW).

The COW technique, available on most Unix systems, only allocates new memory
on the child process when the process tries to change the memory cloned from the
parent process.

This technique has some fantastic benefits, as listed in the following:

• First, the virtual machine and core libraries are already loaded into the
memory. Not having to read this significant chunk of data from the filesystem
to initialize the virtual machine drastically reduces the startup overhead.
• Second, the memory in which these core libraries and common structures
reside is shared by the Zygote with all other applications, resulting in saving
a lot of memory when the user is running multiple apps.

[4]
Chapter 1

Android process model


Android is a multiuser, multitasking system that can run multiple applications in
parallel, where all the applications attempt to acquire CPU time to execute its job.

Each application runs independently on an isolated Linux process cloned from


the Zygote process, and by default, all the Android components run within the
same process with the same name as the application package specified in Android
Application Manifest (AAM).

The Linux kernel will fairly allocate small amounts of CPU time for application
execution called CPU time slices. This time-slicing approach means that even
a single-processor device can appear to be actively working in more than one
application at the same time, when in fact, each application is taking very short
turns on the CPU.

Process ranks
The Android operating system tries to maintain the application running for as long
as possible, but when the available memory is low, it will try to free resources in the
system by killing the processes with lower importance first.

This is when process ranking comes into the picture; the Android processes are
ranked in the next five categories from the higher priority to the lower priorities:

• Foreground process: This is a process that hosts an activity or service that


the user is currently interacting with: a service started in the foreground or
service running its life cycle callbacks
• Visible process: This is a process that hosts a paused activity or service
bounded to a visible activity
• Service process: This is a process that hosts a service not bound to a
visible activity
• Background process: This is a process that hosts a non-visible activity; all
background processes are sorted over a Least-Recently-Used (LRU) list,
therefore, the most recently used processes are the last killed processes when
they have the same rank
• Empty process: This is a process used to cache inactive Android components
and to improve any component startup time

When the system reaches a point that it needs to release resources, the processes
available to be killed will be sorted, taking into account the process rank, last used
processes, and components running.

[5]
Asynchronous Programming in Android

Process sandboxing
The Android application always runs under a unique Linux user ID (UID) assigned
to the application during the application installation so that the process runs on a
sandboxed environment, which by default, isolates your data and code execution
from other apps.

In some cases, a user could explicitly be required to share the UID with another
application to have access to their data:
USER PID PPID VSIZE RSS PC NAME
root 319 1 1537236 31324 S zygote
….
u0_a221 5993 319 1731636 41504 S com.whatsapp
u0_a96 3018 319 1640252 29540 S com.dropbox.android
u0_a255 4892 319 1583828 34552 S com.accuweather.android…

The preceding table that results from running the adb shell ps command in the
computer with Android SDK Table is a list of Android running processes.

The first column shows the user identifier (UID) assigned at the time of installation,
the second column is the process ID (PID), the third column shows the parent
process ID (PPID) that for Android applications is the Zygote process, and the last
column shows the application package.

From this list, we can assure that the WhatsApp application is running under the
user ID u0_a221 with the process ID 5993 and the parent process is the Zygote
process with the PID 319.

Android thread model


Within an Android process, there may be many threads of execution. Each thread
is a separate sequential flow of control within the overall program—it executes its
instructions in order, one after the other, and they also share allocated slices of CPU
time managed by the operating system task scheduler.

While the application process is started by the system and prevented from directly
interfering with data in the memory address space of other processes, the threads
may be started by an application code and can communicate and share data with
other threads within the same process. Apart from the shared data that all the
threads share in the same process, a thread can use its own memory cache to store its
data in its own memory space.

[6]
Chapter 1

The main thread


When the application process starts, apart from DVM housekeeping threads, the
system creates a thread of execution called main. This thread, as the name explains,
plays a crucial role in the application lifetime as it is the thread that interacts with the
Android UI components, updating the state and their look on the device screen.

Moreover, by default, all the Android application components (Activity, Service,


ContentProvider, and BroadcastsReceiver) are also executed over the main
thread line of execution. The following image shows the lists of threads running
inside an application process with the main thread at the top of the list with a unique
thread ID (TID) assigned by the system:

The main thread, also known as UI Thread, is also the thread where your UI event
handling occurs, so to keep your application as responsible as possible, you should:

• Avoid any kind of long execution task, such as input/output (I/O) that could
block the processing for an indefinite amount of time
• Avoid CPU-intensive tasks that could make this thread occupied for a
long time

[7]
Asynchronous Programming in Android

The following diagram displays the main interactions and components involved in
the Looper line of execution thread:

The UI/Main thread, which has a Looper facility attached to it, holds a queue of
messages (MessageQueue) with some unit of work to be executed sequentially.

When a message is ready to be processed on the queue, the Looper Thread pops
the message from the queue and forwards it synchronously to the target handler
specified on the message.

When the target Handler finishes its work with the current message, the Looper
thread will be ready to process the next message available on the queue. Hence, if the
Handler spent a noticeable amount of time processing the message, it will prevent
Looper from processing other pending messages.

For example, when we write the code in an onCreate() method in the Activity
class, it will be executed on the main thread. Likewise, when we attach listeners to
user-interface components to handle taps and other user-input gestures, the listener
callback executes on the main thread.

[8]
Chapter 1

For apps that do little I/O or processing, such as applications that don't do complex
math calculations, don't use the network to implement features, or don't use
filesystem resources, this single thread model is fine. However, if we need to perform
CPU-intensive calculations, read or write files from permanent storage, or talk to
a web service, any further events that arrive while we're doing this work will be
blocked until we're finished.

Since the Android 5.0 (Lollipop), a new important thread named


RenderThread was introduced to keep the UI animations smooth
even when the main thread is occupied doing stuff.

The Application Not Responding (ANR) dialog


As you can imagine, if the main thread is busy with a heavy calculation or reading
data from a network socket, it cannot immediately respond to user input such as a
tap or swipe.

An application that doesn't respond quickly to user interaction will feel


unresponsive—anything more than a couple of hundred milliseconds delay is
noticeable. This is such a pernicious problem that the Android platform protects
users from applications that do too much on the main thread.

If an app does not respond to user input within five seconds, the
user will see the Application Not Responding (ANR) dialog and
will be offered the option to quit the application.

The following screenshot shows a typical Android ANR dialog:

Android works hard to synchronize the user interface redraws with the
hardware-refresh rate. This means that it aims to redraw at the rate of 60 frames per
second—that's just 16.67 ms per frame. If we do work on the main thread that takes
anywhere near 16 ms, we risk affecting the frame rate, resulting in jank—stuttering
animations, jerky scrolling, and so on.

[9]
Asynchronous Programming in Android

Ideally, of course, we don't want to drop a single frame. Jank, unresponsiveness,


and especially the ANR, offer a very poor user experience, which translates into
bad reviews and unpopular applications. A rule to live by when building Android
applications is: do not block the main thread!

Android provides a helpful strict mode setting in Developer Options


on each device, which will flash on the screen when applications
perform long-running operations on the main thread.

Further protection was added to the platform in Honeycomb (API level 11) with the
introduction of a new Exception class, NetworkOnMainThreadException, a subclass
of RuntimeException that is thrown if the system detects network activity initiated
on the main thread.

Maintaining responsiveness
Ideally then, we may want to offload any long-running operations from the main
thread so that they can be handled in the background by another thread, and the
main thread can continue to process user-interface updates smoothly and respond in
a timely fashion to user interactions.

The typical time-consuming tasks that should be handled on a background thread


include the following:

• Network communications
• Input and output file operations on the local filesystem
• Image and video processing
• Complex math calculations
• Text processing
• Data encoding and decoding

For this to be useful, we must be able to coordinate the work and safely pass data
between cooperating threads—especially between background threads and the main
thread, and it is exactly to solve this problem that asynchronous programming
is used.

[ 10 ]
Random documents with unrelated
content Scribd suggests to you:
Wolffert ... was cursing me with all the
eloquence of a rich vocabulary

In a moment an agreement was made by which we were to adjourn


to a retired spot and fight it out. Something that he said led
someone to suggest that we settle it with pistols. It was Peck's
voice. Wolffert sprang at it. "I will, if I can get any gentleman to
represent me," he said with a bitter sneer, casting his flashing,
scornful eyes around on the crowd. "I have only one friend and I will
not ask him to do it."
"I will represent you," said Peck, who had his own reasons for the
offer.
"All right. When and where?" said I.
"Now, and in the railway-cut beyond the wood," said Wolffert.
We retired to two rooms in a neighboring dormitory to arrange
matters. Peck and another volunteer represented Wolffert, and Sam
Pleasants and Harry Houston were my seconds. I had expected that
some attempt at reconciliation would be made; but there was no
suggestion of it. I never saw such cold-blooded young ruffians as all
our seconds were, and when Peck came to close the final cartel he
had an air between that of a butcher and an undertaker. He looked
at me exactly as a butcher does at a fatted calf. He positively licked
his chops. I did not want to shoot Wolffert, but I could cheerfully
have murdered Peck. While, however, the arrangements were being
made by our friends, I had had a chance for some reflection and I
had used it. I knew that Wolffert did not like me. He had no reason
to do so, for I had not only left him, but had been cold and distant
with him. Still, I had always treated him civilly, and had spoken of
him respectfully, which was more than Peck had always done. Yet,
here, without the least provocation, he had insulted me grossly. I
knew there must be some misunderstanding, and I determined on
my "own hook" to find out what it was. Fortune favored me. Just
then Wolffert opened the door. He had gone to his own room for a
few moments and, on his return, mistook the number and opened
the wrong door. Seeing his error, he drew back with an apology, and
was just closing the door when I called him.
"Wolffert! Come in here a moment. I want to speak to you alone."
He re-entered and closed the door; standing stiff and silent.
"Wolffert, there has been some mistake, and I want to know what it
is." He made not the least sign that he heard, except a flash, deep in
his eyes, like a streak of lightning in a far-off cloud.
"I am ready to fight you in any way you wish," I went on. "But I
want to know what the trouble is. Why did you insult me out of a
clear sky? What had I done?"
"Everything."
"What! Specify. What was it?"
"You have made my life Hell—all of you!" His face worked, and he
made a wild sweep with his arm and brought it back to his side with
clenched fist.
"But I?"
"You were the head. You have all done it. You have treated me as an
outcast—a Jew! You have given me credit for nothing, because I was
a Jew. I could have stood the personal contempt and insult, and I
have tried to stand it; but I will put up with it no longer. It is
appointed once for a man to die, and I can die in no better cause
than for my people."
He was gasping with suppressed emotion, and I was beginning to
gasp also—but for a different reason. He went on:
"You thought I was a coward because I was a Jew, and because I
wanted peace—treated me as a poltroon because I was a Jew. And I
made up my mind to stop it. So this evening my chance came. That
is all."
"But what have I done?"
"Nothing more than you have always done; treated the Jew with
contempt. But they were all there, and I chose you as the leader
when you said that about the Jew."
"I said nothing about a Jew. Here, wait! Did you think I insulted you
as a Jew this afternoon?" I had risen and walked over in front of
him.
"Yes." He bowed.
"Well, I did not."
"You did—you said to Sam Pleasants that I was a 'damned Jew.'"
"What! I never said a word like it—yes, I did—I said to Sam
Pleasants, that you did not see the play, and said, 'Sam, you—'
meaning, you, tell him. Wait. Let me think a moment. Wolffert, I
owe you an apology, and will make it. I know there are some who
will think I do it because I am afraid to fight. But I do not care. I am
not, and I will fight Peck if he says so. If you will come with me, I
will make you a public apology, and then if you want to fight still, I
will meet you."
He suddenly threw his right arm up across his face, and, turning his
back on me, leaned on it against the door, his whole person shaken
with sobs.
I walked up close to him and laid my hand on his shoulder,
helplessly.
"Calm yourself," I began, but could think of nothing else to say.
He shook for a moment and then, turning, with his left arm still
across his face, he held out his right hand, and I took it.
"I do not want you to do that. All I want is decent treatment—
ordinary civility," he faltered between his sobs. Then he turned back
and leant against the door, for he could scarcely stand. And so
standing, he made the most forcible, the most eloquent, and the
most burning defence of his people I have ever heard.
"They have civilized the world," he declared, "and what have they
gotten from it but brutal barbarism. They gave you your laws and
your literature, your morality and your religion—even your Christ;
and you have violated every law, human and divine, in their
oppression. You invaded our land, ravaged our country, and
scattered us over the face of the earth, trying to destroy our very
name and Nation. But the God of Israel was our refuge and
consolation. You crucified Jesus and then visited it on us. You have
perpetuated an act of age-long hypocrisy, and have, in the name of
the Prince of Peace, brutalized over his people. The cross was your
means of punishment—no Jew ever used it. But if we had crucified
him it would have been in the name of Law and Order; your
crucifixion was in the name of Contempt; and you have crucified a
whole people through the ages—the one people who have ever
stood for the one God; who have stood for Morality and for Peace. A
Jew! Yes, I am a Jew. I thank the God of Israel that I am. For as he
saved the world in the past, so he will save it in the future."
This was only a part of it, and not the best part; but it gave me a
new insight into his mind.
When he was through I was ready. I had reached my decision.
"I will go with you," I said, "not on your account, but on my own,
and make my statement before the whole crowd. They are still on
the hill. Then, if any one wants to fight, he can get it. I will fight
Peck."
He repeated that he did not want me to do this, and he would not
go; which was as well, for I might not have been able to say so
much in his presence. So I went alone with my seconds, whom I
immediately sought.
I found the latter working over a cartel at a table in the next room,
and I walked in. They looked as solemn as owls, but I broke them
up in a moment.
"You can stop this infernal foolishness. I have apologized to Wolffert.
I have treated him like a pig, and so have you. And I have told him
so, and now I am going out to tell the other fellows."
Their astonishment was unbounded and, at least, one of the group
was sincerely disappointed. I saw Peck's face fall at my words and
then he elevated his nose and gave a little sniff.
"Well, it did not come from our side," he said in a half undertone
with a sneer.
I suddenly exploded. His cold face was so evil.
"No, it did not. I made it freely and frankly, and I am going to make
it publicly. But if you are disappointed, I want to tell you that you
can have a little affair on your own account. And in order that there
may be no want of pretext, I wish to tell you that I believe you have
been telling lies on me, and I consider you a damned, sneaking
hypocrite."
There was a commotion, of course, and the others all jumped in
between us. And when it was over, I walked out. Three minutes later
I was on the hill among the crowd, which now numbered several
hundred, for they were all waiting to learn the result; and, standing
on a bench, I told them what I had said to Wolffert and how I felt I
owed him a public apology, not for one insult, but for a hundred.
There was a silence for a second, and then such a cheer broke out
as I never got any other time in my life! Cheers for Wolffert—cheers
for Marvel, and even cheers for me. And then a freckled youth with a
big mouth and a blue, merry eye broke the tension by saying:
"All bets are off and we sha'n't have a holiday to-morrow at all." The
reprobates had been betting on which of us would fall, and had been
banking on a possible holiday.
Quite a crowd went to Wolffert's room to make atonement for any
possible slight they had put on him; but he was nowhere to be
found. But that night, he and Marvel sat at our table and always sat
there afterward. He illustrated George Borrow's observation that
good manners and a knowledge of boxing will take one through the
world.
IV
DELILAH
My career at college promised at one time after that to be almost
creditable, but it ended in nothing. I was not a good student,
because, I flattered myself, I was too good a fellow. I loved pleasure
too much to apply myself to work, and was too self-indulgent to
deny myself anything. I despised the plodding ways of cold-blooded
creatures like Peck even more than I did the dullness of John Marvel.
Why should I delve at Latin and Greek and Mathematics when I had
all the poets and novelists. I was sure that when the time came I
could read up and easily overtake and surpass the tortoise-like
monotony of Peck's plodding. I now and then had an uneasy
realization that Peck was developing, and that John Marvel, to whom
I used to read Latin, had somehow come to understand the
language better than I. However, this was only an occasional
awakening, and the idea was too unpleasant for me to harbor it
long. Meantime, I would enjoy myself and prepare to bear off the
more shining honors of the orator and society-medalist.
At the very end I did, indeed, arouse myself, for I had a new
incentive. I fell in love. Toward the mid-session holiday the place
always filled up with pretty girls. Usually they came just after "the
exams"; but occasionally some of them came a little in advance:
those who were bent on conquest. At such times, only cold
anchorites like Marvel, or calculating machines like Peck, stuck to
their books. Among the fair visitants this year was one whose
reputation for beauty had already preceded her: Miss Lilian Poole.
She was the daughter of a banker in the capital of the State, and by
all accounts was a tearing belle. She had created a sensation at the
Mardi Gras the year before, and one who could do that must be a
beauty. She was reported more beautiful than Isabelle Henderson,
the noted beauty of the Crescent city, whom she was said to
resemble. Certainly, she was not lacking in either looks or
intelligence; for those who had caught a glimpse of her, declared her
a Goddess. I immediately determined that I would become her
cavalier for the occasion. And I so announced to the dozen or more
fellows who composed our set. They laughed at me.
"Why, you do not know her."
"But I shall know her."
"You are not on speaking terms with Professor Sterner"—the
Professor of Mathematics at whose house she was stopping. The
Professor, a logarithmic machine, and I had had a falling out not
long before. He had called on me for a recitation, one morning after
a dance, and I had said, "I am not prepared, sir."
"You never are prepared," he said, which the class appeared to think
amusing. He glanced over the room.
"Mr. Peck."
Peck, also, had been at the dance the night before, though he said
he had a headache, and caused much amusement by his gambols
and antics, which, were like those of a cow; I therefore expected
him to say, "unprepared" also. But not so.
"I was unwell last night, sir."
"Ah! Well, I am glad, at least, that you have some sort of a
legitimate excuse."
I flamed out and rose to my feet.
"Are you alluding to me, sir?"
"Take your seat, sir. I deny your right to question me."
"I will not take my seat. I do not propose to sit still and be insulted.
I demand an answer to my question."
"Take your seat, I say. I will report you to the Faculty," he shouted.
"Then you will have to do so very quickly; for I shall report you
immediately." And with that, I stalked out of the room. The Faculty
met that afternoon and I laid my complaint before them, and as the
students, knowing the inside facts, took my side, the Faculty held
that the Professor committed the first breach and reprimanded us
both. I was well satisfied after I had met and cut the Professor
publicly.
I now acknowledge the untowardness of the situation; but when the
boys laughed, I pooh-poohed it.
"I do not speak to old Sterner, but I will speak to her the first time I
meet her."
"I will bet you do not," cried Sam Pleasants.
"Supper for the crowd," chimed in several. They were always as
ready to bet as their long-haired ancestors were in the German
forests, where they bet themselves away, and kept their faith, to the
amazement of a Roman gentleman, who wrote, "istam vocant
fidem."
We were all in a room, the windows of which looked across the lawn
toward the pillared portico of Professor Sterner's house, and some of
the boys were gazing over toward the mansion that sheltered the
subject of our thoughts. And as it happened, at that moment, the
door opened and out stepped the young lady herself, in a smart
walking costume, topped by a large hat with a great, drooping,
beguiling, white ostrich feather. An exclamation drew us all to the
window.
"There she is now!" Without doubt, that was she.
"Jove! What a stunner!"
"She is alone. There is your chance."
"Yes, this is the first time you have seen her; now stop jawing and
play ball."
"Or pay up."
"Yes, supper for the crowd: porterhouse steak; chicken, and waffles
to end with."
So they nagged me, one and all.
"Done," I said, "I will do it now."
"You have never seen her before?"
"Never." I was arranging my tie and brushing my hair.
"You swear it?"
But I hurried out of the door and slammed it behind me.
I turned down the walk that led across the campus to the point
whither Miss Poole was directing her steps, and I took a gait that I
judged should meet her at the intersection of the walks. I was doing
some hard thinking, for I knew the window behind me was crowded
with derisive faces.
As I approached her, I cut my eye at her, and a glance nearly
overthrew my resolution. She was, indeed, a charming picture as she
advanced, though I caught little more than a general impression of a
slim, straight, statuesque figure, a pink face, surmounted by a
profusion of light hair, under a big hat with white feathers, and a
pair of bluish eyes. I glanced away, but not before she had caught
my eye. Just then a whistle sounded behind me, and my nerve
returned. I suddenly quickened my pace, and held out my hand.
"Why, how do you do?" I exclaimed with well-feigned surprise and
pleasure, plumping myself directly in front of her. She paused;
looked at me, hesitated, and then drew back slightly.
"I think—, I—. You have made a mistake, I think."
"Why, do you not remember Henry Glave? Is this not Miss Belle
Henderson?" I asked in a mystified way.
"No, I am not Miss Henderson."
"Oh! I beg your pardon—I thought—" I began. Then, as I moved
back a little, I added, "Then you must be Miss Lilian Poole; for there
cannot be more than two like you on earth. I beg your pardon."
I backed away.
"I am," she said. Her mounting color showed that she was at least
not angry, and she gave proof of it.
"Can you tell me? Is not that the way to Dr. Davis's house?"
"Yes—I will show you which it is." My manner had become most
respectful.
"Oh! Don't trouble yourself, I beg you."
"It is not the least trouble," I said sincerely, and it was the only truth
I had told. I walked back a few steps, hat in hand, pointing eagerly
to the house. And as I left, I said, "I hope you will pardon my stupid
mistake."
"Oh! I do not think it stupid. She is a beauty."
"I think so." I bowed low. I saw the color rise again as I turned
away, much pleased with myself, and yet a good deal ashamed, too.
When I returned to "the lair," as we termed Sam Pleasants's room,
the boys seized me. They were like howling dervishes. But I had
grown serious. I was very much ashamed of myself. And I did the
only decent thing I could—I lied, or as good as lied.
"I will give the supper if you will stop this yelling. Do you suppose I
would make a bet about a girl I did not know?"
This took the spirit out of the thing, and only one of them knew the
truth. Marvel, who was present, looked at me seriously, and that
night said to me half sadly,
"You ought not to have done that."
"What? I know it. It was an ungentlemanly thing."
"I do not mean that. You ought not to have told a story afterward."
How he knew it I never knew.
But I had gotten caught in my own mesh. I had walked into the little
parlor without any invitation, and I was soon hopelessly entangled in
the web at which I had hitherto scoffed. I fell violently in love.
I soon overcame the little difficulty that stood in my way. And,
indeed, I think Miss Lilian Poole rather helped me out about this. I
did not allow grass to grow under my feet, or any impression I had
made to become effaced. I quickly became acquainted with my
Diana-like young lady; that is, to speak more exactly, I got myself
presented to her, for my complete acquaintance with her was of later
date, when I had spent all the little patrimony I had. I saw
immediately that she knew the story of the wager, though she did
not at that time refer to it, and so far as I could tell, she did not
resent it. She, at least, gave no sign of it. I asked her to allow me to
escort her to a German, but she had an engagement.
"Who is it?" I inquired rather enviously.
She had a curious expression in her eyes—which, by the way, were a
cool blue or gray, I never could be sure which, and at times looked
rather like steel.
She hesitated a moment and her little mouth drew in somewhat
closely.
"Mr. Peck." Her voice was a singular instrument. It had so great a
compass and possessed some notes that affected me strangely; but
it also could be without the least expression. So it was now when
she said, "Mr. Peck," but she colored slightly, as I burst out laughing.
"Peck! Pecksniff? Did you ever see him dance? I should as soon have
thought of your dancing with a clothes-horse."
She appeared somewhat troubled.
"Does he dance so badly as that? He told me he danced."
"So he does—like this." I gave an imitation of Peck's gyrations, in
which I was so earnest that I knocked over a table and broke a fine
lamp, to my great consternation.
"Well, you are realistic," observed Miss Poole, calmly, who struck me
as not so much concerned at my misfortune as I might have
expected. When, however, she saw how really troubled I was, she
was more sympathetic.
"Perhaps, if we go out, they will not know who did it," she observed.
"Well, no, I could not do that," I said, thinking of Peck, and then as
her expression did not change, I fired a shot that I meant to tell.
"Peck would do that sort of thing. I shall tell them."
To this she made no reply. She only looked inscrutably pretty. But it
often came back to me afterward how calmly and quite as a matter
of course she suggested my concealing the accident, and I
wondered if she thought I was a liar.
She had a countenance that I once thought one of the most
beautiful in the world; but which changed rarely. Its only variations
were from an infantile beauty to a statuesque firmness.
Yet that girl, with her rather set expression and infantile face, her
wide open, round eyes and pink prettiness, was as deep as a well,
and an artesian well at that.
I soon distanced all rivals. Peck was quickly disposed of; though,
with his nagging persistence, he still held on. This bored me
exceedingly and her too, if I could judge by her ridicule of him and
her sarcasm which he somehow appeared too stupid to see. He
succumbed, however, to my mimicry of his dancing; for I was a good
mimic, and Peck, in a very high collar and with very short trousers
on his dumpy legs, was really a fair mark. Miss Poole was by no
means indifferent to public opinion, and a shaft of satire could
penetrate her mail of complacency. So when she returned later to
the classic shades of the university, as she did a number of times for
Germans and other social functions, I made a good deal of hay. A
phrase of Peck's, apropos of this, stuck in my memory. Some one—it
was, I think, Leo Wolffert—said that I appeared to be making hay,
and Peck said, "Yes, I would be eating it some day." I often
wondered afterward how he stumbled on the witticism.
Those visits of my tall young dulcinea cost me dear in the sequel.
While the other fellows were boning I was lounging in the drawing-
room chattering nonsense or in the shade of the big trees in some
secluded nook, writing her very warm poems of the character which
Horace says is hated both of Gods and men. Several of these poems
were published in the college magazine. The constant allusions to
her physical charms caused Peck to say that I evidently considered
Miss Poole to be "composed wholly of eyes and hair." His observation
that a man was a fool to write silly verses to a girl he loved, because
it gave her a wrong idea of her charms, I, at the time, set down to
sheer envy, for Peck could not turn a rhyme; but since I have
discovered that for a practical person like Peck, it has a foundation,
of truth.
V
THE HARE AND THE TORTOISE
Meantime, my studies—if any part of my desultory occupation could
be so termed—suffered undeniably. My appearance at the classroom
door with a cigarette, which I flung away just in time not to carry it
into the room, together with my chronic excuse of being
"unprepared," moved the driest of my professors to the witticism
that I "divided my time between a smoke and a flame." It was only
as the finals drew near that I began to appreciate that I would have
the least trouble in "making my tickets," as the phrase went. Sam
Pleasants, Leo Wolffert and my other friends had begun to be
anxious for me for some time before—and both Wolffert and John
Marvel had come to me and suggested my working, at least, a little:
Wolffert with delicacy and warmth; John Marvel with that awkward
bluntness with which he always went at anything. I felt perfectly
easy in my mind then and met their entreaties scornfully.
"Why, I did well enough at the Intermediates," I said.
"Yes, but," said John Marvel, "Delilah was not here then——"
I was conscious, even though I liked the reference to Samson, of
being a little angered; but John Marvel looked so innocent and so
hopelessly friendly that I passed it by with a laugh and paid Miss
Poole more attention than ever.
The Debater's Medal had for a long time been, in the general
estimation, as good as accorded me; for I was a fluent, and I
personally thought, eloquent speaker, and had some reading. But
when Wolffert entered the debate, his speeches so far outshone
mine that I knew at once that I was beat. They appeared not so
much prepared for show, as mine were, as to come from a
storehouse of reading and reflection. Wolffert, who had begun to
speak without any design of entering the contest for the Medal,
would generously have retired, but I would not hear of that. I called
Peck to account for a speech which I had heard of his making: that
"the contest was between a Jew and a jug"; but he denied making
it, so I lost even that satisfaction.
I worked for the Magazine Medal; but my "poems"—"To Cynthia"
and "To Felicia," and my fanciful sketches, though they were thought
fine by our set, did not, in the estimation of the judges, equal the
serious and solemn essays on Julius Cæsar and Alexander Hamilton,
to which the prize was awarded. At least, the author of those essays
had worked over them like a dog, and in the maturer light of
experience, I think he earned the prizes.
I worked hard—at least, at the last, for my law degree, and every
one was sure I would win—as sure as that Peck would lose; but Peck
scraped through while mine was held up—because the night before
the degrees were posted I insisted on proving to the professor who
had my fate in his hands, and whom I casually ran into, that a
"gentleman drunk was a gentleman sober," the idea having been
suggested to my muddled brain by my having just been good-
natured enough to put to bed Peck. I finally got the degree, but not
until I had been through many tribulations, one of which was the
sudden frost in Miss Poole's manner to me. That girl was like autumn
weather. She could be as warm as summer one minute and the next
the thermometer would drop below the freezing point. I remember I
was her escort the evening of the Final Ball. She looked like Juno
with the flowers I had gone out in the country to get for her from an
old garden that I knew. Her face was very high bred and her pose
majestic. I was immensely proud of her and of myself as her escort
—and as Peck stalked in with a new and ill-fitting suit of "store-
clothes" on, I fancy I put on my toppiest air. But Peck had a shaft
and he came there to shoot it. As he passed near us, he said in a
loud voice to someone, "The B. L. list is posted."
"Are you through?" demanded the other.
"Yep."
"Anybody failed 't we expected to get through?"
"'T depends on who you expected to get through. Glave's not on it."
His shaft came home. I grew cold for a minute and then recovered
myself. I saw my partner's face change. I raised my head and
danced on apparently gayer than ever, though my heart was lead.
And she played her part well, too. But a few minutes later when
Peck strutted up, a decided cock to his bullet head, I heard her, as I
turned away, congratulate him on his success.
I slipped out and went over to the bulletin-board where the degree-
men were posted, and sure enough, I was not among them. A
curious crowd was still standing about and they stopped talking as I
came up, so I knew they had been talking about me. I must say that
all showed concern, and sympathy was written on every face. It
was, at least, sweet to know that they all considered it a cursed
shame, and set my failure down to hostility on the part of one of the
professors. I was determined that no one should know how hard hit
I was, and I carried my head high till the ball was out, and was so
lofty with Miss Poole that she was mystified into being very
receptive. I do not know what might have happened that night if it
had not been for old John Marvel. I learned afterward that I was
pretty wild. He found me when I was wildly denouncing the law
professor who had failed to put me through in some minor course,
and was vowing that I would smash in his door and force my
diploma from him. I might have been crazy enough to attempt it had
not old John gotten hold of me. He and Wolffert put me to bed and
stayed with me till I was sober. And sober enough I was next day.
As I have said, I received my diploma finally; but I lost all the
prestige and pleasure of receiving it along with my class, and I
passed through some of the bitterest hours that a young man can
know.
Among my friends at college—I might say among my warmest
friends—was my old crony "Jeams," or, as he spoke of himself to
those whom he did not regard as his social equals, or whom he
wanted to amuse himself with, "Mister Woodson"; a little later
changed to "Professor Woodson," as more dignified and consonant
with the managing class of the institution. When I left for college he
followed me, after a brief interval, and first appeared as a waiter at
the college boarding-house where I boarded, having used my name
as a reference, though at home he had never been nearer the
dining-room than the stable. Here he was promptly turned out, and
thereupon became a hanger-on of mine and a "Factotum" for me
and my friends.
He was now a tall, slim fellow, with broad shoulders and the muscles
of Atlas—almost but not quite black and with a laugh that would
have wiled Cerberus. He had the shrewdness of a wild animal, and
was as imitative as a monkey, and this faculty had inspired and
enabled him to pick up all sorts of acquirements, ranging from
reading and writing to sleight-of-hand tricks, for which he showed a
remarkable aptitude. Moreover, he had a plenty of physical courage,
and only needed to be backed by someone, on whom he relied, to
do anything.
I was naturally attached to him and put up with his rascalities,
though they often taxed me sorely, while he, on his part, was so
sincerely attached to me, that I believe he would have committed
any crime at my bidding.
He considered my old clothes his property, and what was far more
inconvenient, considered himself the judge of the exact condition
and moment when they should pass from my possession to his.
He was a handsome rascal, and took at times such pride in his
appearance that, as he was about my size, I had often to exercise a
close watch on my meagre wardrobe. He had not only good, but
really distinguished manners, and, like many of his race, prided
himself on his manners. Thus, on an occasion when he passed Peck
at college, and touched his hat to him, a civility which Peck ignored,
Wolffert said to him, "Jeams, Mr. Peck don't appear to recognize
you."
"Oh! yes," said Jeams, "he recognizes me, but he don't recognize
what's due from one gent'man to another."
"Are you going to keep on touching your hat to him?" asked
Wolffert.
"Oh! yes, suh," said Jeams, "I takes keer o' my manners, and lets
him take keer o' hisn'."
Such was "Jeams," my "body servant," as he styled himself, on
occasions when he had an eye to some article of my apparel or
stood in especial need of a donation.
He hated Peck with as much violence as his easygoing nature was
capable of, and had no liking for Wolffert. The fact that the latter
was a Jew and yet my friend, staggered him, though he put up with
him for my sake, and on the night of my fight with Wolffert, I think
he would, had he had a chance, have murdered him, as I am sure
he would have murdered the professor who threw me on my degree.
He got much fuller than I got that night, and his real grief and
shame were among the heaviest burdens I had to bear.
Miss Poole returned home the next afternoon after the delivery of
the diplomas, and I heard that Peck went off on the same train with
her.
I expected some sympathy from the girl for whom my devotion had
cost me so much; but she was as cool and sedate over my failure as
if it had been Peck's.
All she said was, "Why did not you win the honors?"
"Because I did not work enough for them."
"Why did not you work more?"
I came near saying, "Because I was fooling around you"; but I
simply said, "Because I was so certain of winning them."
"You showed rather bad judgment." That was all the sympathy I
received from her.
The old law professor when he took leave of me said—and I
remember said it gravely—"Mr. Glave, you have the burden of too
many gifts to carry."
I was pleased by the speech and showed it. He looked at me keenly
from under his bushy eyebrows. "I commend to you the fable of the
hare and the tortoise. We shall hear of Peck."
I wondered how he knew I was thinking of Peck with his common
face, hard eyes, and stumpy legs.
"You shall hear of me, too," I declared with some haughtiness.
He only smiled politely and made no answer.
Nettled, I asked arrogantly, "Don't you think I have more sense—
more intellect than Peck?"
"More intellect—yes—much more.—More sense? No. Remember the
fable. 'There are ways that you know not and paths that you have
not tried.'"
"Oh! that fable—it is as old as——"
"Humanity," he said. "'To scorn delights and live laborious days.' You
will never do that—Peck will."
I left him, angry and uncomfortable.
I had rather looked forward to going to the West to a near cousin of
my father's, who, if report were true, had made a fortune as a
lawyer and an investor in a Western city. He and my father had been
boys together, but my cousin had gone West and when the war
came, he had taken the other side. My father, however, always
retained his respect for him and spoke of him with affection. He had
been to my home during my early college-life—a big, stolid, strong-
faced man, silent and cold, but watchful and clear-minded—and had
appeared to take quite a fancy to me.
"When he gets through," he had said to my father, "send him out to
me. That is the place for brains and ambition, and I will see what is
in him for you."
Now that I had failed, I could not write to him; but as he had made
a memorandum of my graduation year, and as he had written my
father several times, I rather expected he would open the way for
me. But no letter came. So I was content to go to the capital of the
State.
VI
THE METEOR
I am convinced now that as parents are the most unselfish
creatures, children are the veriest brutes on earth. I was too self-
absorbed to think of my kind father, who had sacrificed everything to
give me opportunities which I had thrown under the feet of Lilian
Poole and who now consoled and encouraged me without a word of
censure. Though I was deeply grieved at the loss of my parents, I
did not know until years afterward what an elemental and life-long
calamity that loss was.
My father appeared as much pleased with my single success as if I
had brought him home the honors which I had been boasting I
would show him. He gave me only two or three bits of advice before
I left home. "Be careful with other people's money and keep out of
debt," he said. "Also, have no dealings with a rascal, no matter how
tightly you think you can tie him up." And his final counsel was,
"Marry a lady and do not marry a fool."
I wondered if he were thinking of Lilian Poole.
However, I had not the least doubt in my mind about winning
success both with her and with that even more jealous Mistress—
The Law. In fact, I quite meant to revolutionize things by the
meteoric character of my career.
I started out well. I took a good office fronting on the street in one
of the best office-buildings—an extravagance I could not afford. Peck
had a little dark hole on the other side of the hall. He made a half
proposal to share my office with me, but I could not stand that. I,
however, told him that he was welcome to use my office and books
as much as he pleased, and he soon made himself so much at home
in my office that I think he rather fell into the habit of thinking my
clients his own.
Before I knew many people I worked hard; read law and a great
deal of other literature. But this did not last long, for I was social
and made acquaintances easily. Moreover, I soon began to get
cases; though they were too small to satisfy me—quite below my
abilities, I thought. So, unless they promised me a chance of
speaking before a jury, I turned them over to Peck, who would bone
at them and work like a horse, though I often had to hunt up the
law for him, a labor I never knew him to acknowledge.
At first I used to correspond with both John Marvel and Wolffert; but
gradually I left their letters unanswered. John, who had gone West,
was too full of his country parish to interest me, and Wolffert's
abstractions were too altruistic for me.
Meantime, I was getting on swimmingly. I was taken into the best
social set in the city, and was soon quite a favorite among them. I
was made a member of all the germans as well as of the best club in
town; was welcomed in the poker-game of "the best fellows" in
town, and was invited out so much that I really had no time to do
much else than enjoy my social success. But the chief of the many
infallible proofs I had was my restoration to Lilian Poole's favor. Since
I was become a sort of toast with those whose opinion she valued
highly, she was more cordial to me than ever, and I was ready
enough to let by-gones be by-gones and dangle around the
handsomest girl in the State, daughter of a man who was president
of a big bank and director of a half-dozen corporations. I was with
her a great deal. In fact, before my second winter was out, my name
was coupled with hers by all of our set and many not in our set. And
about three evenings every week I was to be found basking in her
somewhat steady smile, either at some dance or other social
entertainment; strolling with her in the dusk on our way home from
the fashionable promenade of —— Street—which, for some reason,
she always liked, though I would often have preferred some quieter
walk—or lounging on her plush-covered sofa in her back drawing-
room. I should have liked it better had Peck taken the hint that most
of my other friends had taken and kept away from her house on
those evenings which by a tacit consent of nearly every one were
left for my visits. But Peck, who now professed a great friendship for
me, must take to coming on precisely the evenings I had selected
for my calls. He never wore a collar that fitted him, and his boots
were never blacked. Miss Lilian used to laugh at him and call him
"the burr"—indeed, so much that I more than once told her, that
while I was not an admirer of Peck myself, I thought the fact that he
was really in love with her ought to secure him immunity from her
sarcasm. We had quite a stiff quarrel over the matter, and I told her
what our old law professor had said of Peck.
I had rather thought that, possibly, Mr. Poole, knowing of the
growing relation of intimacy between myself and his daughter, would
throw a little of his law business my way; but he never did. He did,
in fact, once consult me at his own house about some extensive
interests that he owned and represented together in a railway in a
Western city; but though I took the trouble to hunt up the matter
and send him a brief on the point carefully prepared, he did not
employ me, and evidently considered that I had acted only as a
friend. It was in this investigation that I first heard of the name
Argand and also of the P. D. and B. D. R.R. Co. I heard long
afterward that he said I had too many interests to suit him; that he
wanted a lawyer to give him all his intellect, and not squander it on
politics, literature, sport, and he did not know what besides. This
was a dig at my rising aspirations in each of these fields. For I used
to write now regularly for the newspapers, and had one or two
articles accepted by a leading monthly magazine—a success on
which even Peck congratulated me, though he said that, as for him,
he preferred the law to any other entertainment. My newspaper
work attracted sufficient attention to inspire me with the idea of
running for Congress, and I began to set my traps and lay my
triggers for that.
Success appeared to wait for me, and my beginning was "meteoric."
Meteoric beginnings are fatal. The meteor soon fades into outer
darkness—the outer darkness of the infinite abyss. I took it for
success and presumed accordingly, and finally I came down. I played
my game too carelessly. I began to speculate—just a little at first;
but more largely after awhile. There I appeared to find my proper
field; for I made money almost immediately, and I spent it freely,
and, after I had made a few thousands, I was regarded with respect
by my little circle.
I began to make money so much more easily by this means than I
had ever done by the law that I no longer thought it worth while to
stay in my office, as I had done at first, but spent my time, in a flock
of other lambs, in front of a blackboard in a broker's office, figuring
on chances which had already been decided in brokers' offices five
hundred miles away. Thus, though I worked up well the cases I had,
and was fairly successful with them, I found my clients in time
drifting away to other men not half as clever as I was, who had no
other aim than to be lawyers. Peck got some of my clients. Indeed,
one of my clients in warning me against speculating, which, he said,
ruined more young men than faro and drink together, told me he
had learned of my habit through Peck. Peck was always in his office
or mine. I had made some reputation, however, as a speaker, and as
I had taken an active part in politics and had many friends, I stood a
good chance for the commonwealth's attorneyship; but I had
determined to fly higher: I wanted to go to Congress.
I kept a pair of horses now, since I was so successful, and used to
hunt in the season with other gay pleasure-lovers, or spend my
afternoons riding with Miss Poole, who used to look well on
horseback. We often passed Peck plodding along alone, stolid and
solemn, "taking his constitutional," he said. I remember once as we
passed him I recalled what the old professor had said of him, and I
added that I would not be as dull as Peck for a fortune. "Do you
know," said Miss Poole, suddenly, "I do not think him so dull; he has
improved." Peck sat me out a few nights after this, and next day I
nearly insulted him; but he was too dull to see it.
I knew my young lady was ambitious; so I determined to please her,
and, chucking up the fight for the attorneyship, I told her I was
going to Congress, and began to work for it. I was promised the
support of so many politicians that I felt absolutely sure of the
nomination.
Peck told me flatly that I did not stand the ghost of a show; and
began to figure. Peck was always figuring. He advised me to stand
for the attorneyship, and said I might get it if I really tried. I knew
better, however, and I knew Peck, too, so I started in. To make a
fight I wanted money, and it happened that a little trip I had taken
in the summer, when I was making a sort of a splurge, together with
an unlooked-for and wholly inexplicable adverse turn in the market
had taken all my cash. So, to make it up, I went into the biggest
deal I ever tried. What was the use of fooling about a few score
dollars a point when I could easily make it a thousand? I would no
longer play at the shilling-table. I had a "dead-open-and-shut thing"
of it. I had gotten inside information of a huge railroad deal quietly
planned, and was let in as a great favor by influential friends, who
were close friends of men who were manipulating the market, and
especially the P. D. and B. D., a North-western road which had been
reorganized some years before. Mr. Poole had some interest in it and
this made me feel quite safe as to the deal. I knew they were
staking their fortunes on it. I was so sure about it that I even
advised Peck, for whom I had some gratitude on account of his
advice about the attorneyship, to let me put him in for a little. But he
declined. He said he had other use for his money and had made it a
rule not to speculate. I told him he was a fool, and I borrowed all I
could and went in.
It was the most perfectly managed affair I ever saw. We—our
friends—carried the stock up to a point that was undreamed of, and
money was too valuable to pay debts with, even had my creditors
wanted it, which they did not, now that I had recouped and was
again on the crest of the wave. I was rich and was doubling up in a
pyramid, when one of those things happened that does not occur
once in ten million times and cannot be guarded against! We were
just prepared to dump the whole business, when our chief backer, as
he was on his way in his carriage to close the deal, was struck by
lightning! I was struck by the same bolt. In twenty minutes I was in
debt twenty thousand dollars. Telegrams and notices for margin
began to pour in on me again within the hour. None of them
bothered me so much, however, as a bank notice that I had
overchecked an account in which I had a sum of a few hundred
dollars belonging to a client of mine—an old widowed lady, Mrs.
Upshur, who had brought it to me to invest for her, and who trusted
me. She had been robbed by her last agent and this was really all
that was left her. I remembered how she had insisted on my keeping
it for her against the final attack of the wolf, she had said. "But
suppose I should spend it," I had said jesting. "I'm not afraid of your
spending it, but of myself—I want so many things. If I couldn't trust
you, I'd give up." And now it was gone. It came to me that if I
should die at that moment she would think I had robbed her, and
would have a right to think so. I swear that at the thought I
staggered, and since then I have always known how a thief must
sometimes feel. It decided me, however. I made up my mind that
second that I would never again buy another share of stock on a
margin as long as I lived, and I wrote telegrams ordering every
broker I had to sell me out and send me my accounts, and I
mortgaged my old home for all I could get. I figured that I wanted
just one hundred dollars more than I had. I walked across the hall
into Peck's little dark office. He was poring over a brief. I said, "Peck,
I am broke."
"What? I am sorry to hear it—but I am not surprised." He was
perfectly cool, but did look sorry.
"Peck," I went on, "I saw you pricing a watch the other day. Here is
one I gave three hundred dollars for." I showed him a fine
chronometer repeater I had bought in my flush time.
"I can't give over a hundred dollars for a watch," he said.
"How much will you give me for this?"
"You mean with the chain?"
"Yes"—I had not meant with the chain, but I thought of old Mrs.
Upshur.
"I can't give over a hundred."
"Take it," and I handed it to him and he gave me a hundred-dollar
bill, which I took with the interest and handed, myself, to my old
lady, whom I advised to let Peck invest for her on a mortgage. This
he did, and I heard afterward netted her six per cent—for a time.
That evening I went to see Lilian Poole. I had made up my mind
quickly what to do. That stroke of lightning had showed me
everything just as it was, in its ghastliest detail. If she accepted me,
I would begin to work in earnest, and if she would wait, as soon as I
could pay my debts, I would be ready; if not, then—! However, I
walked right in and made a clean breast of it, and I told her up and
down that if she would marry me I would win. I shall never forget
the picture as she stood by the heavy marble mantel in her father's
rich drawing-room, tall and uncompromising and very handsome.
She might have been marble herself, like the mantel, she was so
cold, and I, suddenly aroused by the shock, was on fire with resolve
and fierce hunger for sympathy. She did not hesitate a moment; and
I walked out. She had given me a deep wound. I saw the sun rise in
the streets.
Within two weeks I had made all my arrangements; had closed up
my affairs; given up everything in the world I had; executed my
notes to my creditors and told them they were not worth a cent
unless I lived, in which case they would be worth principal and
interest; sold my law books to Peck for a price which made his eyes
glisten, had given him my office for the unexpired term, and was
gone to the West.
The night before I left I called to see the young lady again—a piece
of weakness. But I hated to give up.
She looked unusually handsome.
I believe if she had said a word or had looked sweet at me I might
have stayed, and I know I should have remained in love with her.
But she did neither. When I told her I was going away, she said,
"Where?" That was every word—in just such a tone as if she had
met me on the corner, and I had said I was going to walk. She was
standing by the mantel with her shapely arm resting lightly on the
marble. I said, "God only knows, but somewhere far enough away."
"When are you coming back?"
"Never."
"Oh, yes, you will," she said coolly, arranging a bracelet, so coolly
that it stung me like a serpent and brought me on my feet.
"I'll be—! No, I will not," I said. "Good-by."
"Good-by." She gave me her hand and it was as cool as her voice.
"Good-by." And mine was as cold as if I were dead. I swear, I believe
sometimes I did die right there before her and that a new man took
my place within me. At any rate my love for her died, slain by the ice
in her heart; and the foolish fribble I was passed into a man of
resolution.
As I walked out of her gate, I met Peck going in, and I did not care.
I did not even hate him. I remember that his collar was up to his
ears. I heard afterward that she accepted him that same week. For
some inexplicable reason I thought of John Marvel as I walked
home. I suddenly appeared nearer to him than I had done since I
left college, and I regretted not having answered his simple,
affectionate letters.
I started West that night.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

textbookfull.com

You might also like