100% found this document useful (2 votes)
22 views

Get (Ebook) Developing Android on Android: Automate Your Device with Scripts and Tasks by Mike Riley ISBN 9781937785543, 1937785548 free all chapters

The document promotes various ebooks related to Android development, including 'Developing Android on Android' by Mike Riley, which focuses on automating devices with scripts and tasks. It provides links to download the full versions and suggests additional titles for readers interested in programming and automation with Android. The content emphasizes the evolution of Android and its development tools, highlighting the potential for modern Android devices to perform complex computing tasks.

Uploaded by

hastyhaysece
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
22 views

Get (Ebook) Developing Android on Android: Automate Your Device with Scripts and Tasks by Mike Riley ISBN 9781937785543, 1937785548 free all chapters

The document promotes various ebooks related to Android development, including 'Developing Android on Android' by Mike Riley, which focuses on automating devices with scripts and tasks. It provides links to download the full versions and suggests additional titles for readers interested in programming and automation with Android. The content emphasizes the evolution of Android and its development tools, highlighting the potential for modern Android devices to perform complex computing tasks.

Uploaded by

hastyhaysece
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

Visit https://ebooknice.

com to download the full version and


explore more ebooks

(Ebook) Developing Android on Android: Automate Your


Device with Scripts and Tasks by Mike Riley ISBN
9781937785543, 1937785548

_____ Click the link below to download _____


https://ebooknice.com/product/developing-android-on-
android-automate-your-device-with-scripts-and-
tasks-4653910

Explore and download more ebooks at ebooknice.com


Here are some recommended products that might interest you.
You can download now and explore!

(Ebook) Programming Your Home: Automate with Arduino, Android, and


Your Computer by Mike Riley ISBN 9781934356906, 1934356905

https://ebooknice.com/product/programming-your-home-automate-with-
arduino-android-and-your-computer-2609258

ebooknice.com

(Ebook) Programming Your Home: Automate with Arduino, Android, and


Your Computer (for Juan Martinez) by Mike Riley ISBN 9781934356906,
1934356905

https://ebooknice.com/product/programming-your-home-automate-with-
arduino-android-and-your-computer-for-juan-martinez-42994556

ebooknice.com

(Ebook) Android for beginners: all you need to get started with your
Android device by White, Jon ISBN 9781909372757, 1909372757

https://ebooknice.com/product/android-for-beginners-all-you-need-to-
get-started-with-your-android-device-5671976

ebooknice.com

(Ebook) Android Studio 3.3 Development Essentials - Android 9 Edition:


Developing Android 9 Apps Using Android Studio 3.3, Java and Android
Jetpack by Neil Smyth ISBN 9781795654760, 1795654767

https://ebooknice.com/product/android-studio-3-3-development-
essentials-android-9-edition-developing-android-9-apps-using-android-
studio-3-3-java-and-android-jetpack-10469504
ebooknice.com
(Ebook) Learning Embedded Android N Programming: Create the perfectly
customized system by unleashing the power of Android OS on your
embedded device by Ivan Morgillo, Stefano Viola ISBN 9781785282881,
1785282883
https://ebooknice.com/product/learning-embedded-android-n-programming-
create-the-perfectly-customized-system-by-unleashing-the-power-of-
android-os-on-your-embedded-device-23141554
ebooknice.com

(Ebook) Android Studio Iguana Essentials - Kotlin Edition: Developing


Android Apps Using Android Studio 2023.2.1 and Kotlin by Neil Smyth

https://ebooknice.com/product/android-studio-iguana-essentials-kotlin-
edition-developing-android-apps-using-android-studio-2023-2-1-and-
kotlin-56375076
ebooknice.com

(Ebook) Android Studio Arctic Fox Essentials - Java Edition:


Developing Android Apps Using Android Studio 2020.31 and Java by Neil
Smyth ISBN EE5DEAAAQBAJ

https://ebooknice.com/product/android-studio-arctic-fox-essentials-
java-edition-developing-android-apps-using-android-studio-2020-31-and-
java-35928982
ebooknice.com

(Ebook) Android Studio Electric Eel Essentials - Java Edition:


Developing Android Apps Using Android Studio 2022.1.1 and Java by Neil
Smyth ISBN 9781951442583, 195144258X

https://ebooknice.com/product/android-studio-electric-eel-essentials-
java-edition-developing-android-apps-using-android-
studio-2022-1-1-and-java-49039778
ebooknice.com

(Ebook) Android Studio Electric Eel Essentials - Kotlin Edition:


Developing Android Apps Using Android Studio 2022.1.1 and Kotlin by
Neil Smyth ISBN 9781951442576, 1951442571

https://ebooknice.com/product/android-studio-electric-eel-essentials-
kotlin-edition-developing-android-apps-using-android-
studio-2022-1-1-and-kotlin-49039782
ebooknice.com
Developing Android on Android Automate Your Device
with Scripts and Tasks 1st Edition Mike Riley Digital
Instant Download
Author(s): Mike Riley
ISBN(s): 9781937785543, 1937785548
Edition: 1
File Details: PDF, 25.31 MB
Year: 2013
Language: english
V413HAV
V413HAV
Developing Android on Android
Automate Your Device with Scripts and Tasks

Mike Riley

The Pragmatic Bookshelf


Dallas, Texas • Raleigh, North Carolina

V413HAV
V413HAV
Many of the designations used by manufacturers and sellers to distinguish their products
are claimed as trademarks. Where those designations appear in this book, and The Pragmatic
Programmers, LLC was aware of a trademark claim, the designations have been printed in
initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer,
Pragmatic Programming, Pragmatic Bookshelf, PragProg and the linking g device are trade-
marks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes
no responsibility for errors or omissions, or for damages that may result from the use of
information (including program listings) contained herein.
Our Pragmatic courses, workshops, and other products can help you and your team create
better software and have more fun. For more information, as well as the latest Pragmatic
titles, please visit us at http://pragprog.com.

The Android robot is reproduced or modified from work created and shared by Google and
used according to terms described in the Creative Commons 3.0 Attribution License.

The team that produced this book includes:


Jacquelyn Carter (editor)
Potomac Indexing, LLC (indexer)
Molly McBeath (copyeditor)
David J Kelly (typesetter)
Janet Furlow (producer)
Juliet Benda (rights)
Ellie Callahan (support)

Copyright © 2013 The Pragmatic Programmers, LLC.


All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or


transmitted, in any form, or by any means, electronic, mechanical, photocopying,
recording, or otherwise, without the prior consent of the publisher.

Printed in the United States of America.


ISBN-13: 978-1-937785-54-3
Encoded using the finest acid-free high-entropy binary digits.
Book version: P1.0—November 2013

V413HAV
This book is dedicated to my three favorite
M’s: Marinette, Marielle, and Mitchell.

V413HAV
Contents
Acknowledgments . . . . . . . . . . . ix

Introduction . . . . . . . . . . . . . xi

Part I — Customize
1. Getting Started . . . . . . . . . . . . 3
1.1 Analyzing Your Mobile Lifestyle 3
1.2 Mobile Personalization 6
1.3 Next Steps 8

2. Personalizing Your Home Screen . . . . . . . . 9


2.1 Launchers 10
2.2 Widgets 14
2.3 Floaters 19
2.4 Home Screen Customization 22
2.5 Next Steps 25

3. Listening to Your Android . . . . . . . . . 27


3.1 Wearable Computing 27
3.2 The Sound of Data 29
3.3 Button Control 33
3.4 Next Steps 37

Part II — Explore
4. Automating with Tasker . . . . . . . . . . 41
4.1 Introducing Tasker 41
4.2 Talking Clock 43
4.3 Train Station Alarm 53

V413HAV
Contents • vi

4.4 Tasker App Factory 57


4.5 Next Steps 61

5. Scripting with SL4A . . . . . . . . . . . 63


5.1 SL4A: Scripting Layer for Android 63
5.2 Programming with SL4A 67
5.3 Scheduling the SL4A Script 69
5.4 Other Android-Ported Languages 71
5.5 Next Steps 72

6. Programming with AIDE . . . . . . . . . . 75


6.1 Getting Started 76
6.2 Programming the Clock 78
6.3 The Clock Is Running 84
6.4 Talking Clock Automation 86
6.5 Next Steps 88

Part III — Build


7. Tasker Pomodoro Widget . . . . . . . . . 93
7.1 Rapid Tasker Prototyping 93
7.2 Pomodoro Widget Redux 98
7.3 Testing the Revised Widget 107
7.4 Addressing the Limitations 111
7.5 Next Steps 113

8. Messaging Projects . . . . . . . . . . . 115


8.1 Check Email 115
8.2 Speak ’n’ Tweet 126
8.3 Jabber Tracker 136
8.4 Next Steps 143

9. Notification Projects . . . . . . . . . . 145


9.1 Talking Notifications 145
9.2 Forecast.io 151
9.3 AutoNotification 158
9.4 Next Steps 163

10. Graphics Projects . . . . . . . . . . . 165


10.1 Application Launcher 165
10.2 Twitch.tv Widget 172
10.3 Next Steps 183

V413HAV
Contents • vii

Part IV — Appendixes
A1. Android Programming Tools . . . . . . . . 187
A1.1 Code Editors 187
A1.2 Source Version Control 193
A1.3 Miscellaneous Tools 198

A2. Resources on the Web . . . . . . . . . . 201

Bibliography . . . . . . . . . . . . 203

Index . . . . . . . . . . . . . . 205

V413HAV
Acknowledgments
This is my second book for Pragmatic Bookshelf, and it has been a pleasure
to once again work with my dedicated and insightful development editor,
Jackie Carter. If you can follow along with the projects without any problem,
you have Jackie to thank. Her editorial skills and professional project man-
agement were crucial in keeping the book flowing smoothly and on schedule.

I would also like to thank all the wonderful technical editors and beta reader
participants who shared valuable feedback, caught typos and other errors,
and generally offered excellent suggestions on improving the quality of the
book. In particular, I would like to thank Mike Bengtson for his awesome
ingenuity, Corey Butler for his progressive technical edge, Ed Burnette for
his pragmatic expertise, John Cairns for his eagle-eye criticality, and Glen
Ferrel for his proofreading expertise and infectious enthusiasm. I also want
to give a big shout-out to Dr. James Withers and Simon Wood (two of the
geniuses behind the awesome SwiftKey Android soft keyboard replacement
program) for their eagle-eye analysis of the book’s content. And a special
thank-you goes to Jan Debiec and Cristina Zamora for their vigilant review
of the material, active participation in the beta, and unending encouragement
for my work. I am so blessed and humbled to be surrounded by such techni-
cally minded people as gifted, kind, and supportive as you.

No amount of thanks can match the sacrifice my family made to give me the
time to devote to another book. I promise to take a break from book writing
for a while so I can make up for lost time with you.

Lastly, a big high-five to publishers Andy Hunt and Dave Thomas for once
again entrusting me to deliver a book worthy of the Pragmatic Bookshelf
imprint. Thank you for giving me such a wonderfully rewarding opportunity
to do so.

V413HAV report erratum • discuss


Introduction
In this book, we’re going on a journey of discovery. We’re going to discover
how amazing the Android OS is and how it is transforming the way people
communicate. We’re also going to learn how to leave our legacy desktop PCs
behind, even for native Android application development needs.

The idea for this book was the result of a conversation I had with Pragmatic
Bookshelf publisher Dave Thomas. He had just acquired a Galaxy S3 Android
phone and wanted to know what kind of cool things he could do with it. Since
I have been an Android user since the release of the first commercial Android
phone, the G1, I had a few suggestions on where to start. As he became more
enthusiastic about the broad possibilities of customization and personalization
that the Android platform has to offer, a new book on the subject started to
crystallize.

The objectives of this book are simple. You will learn about how to apply and
codify your mobile automation needs in an Android program. Using both
scripting and native application development approaches, we will build several
programs that not only teach you how to quickly automate your mobile lifestyle
but also give you the skills to extend these programs beyond their tutorial
roots.

Why Android? Why Now?


The Android OS is several years old, and its design principles (a modern, true
multitasking mobile OS with built-in memory, permissions management, and
so on) have been the same since its inception. So why is this book relevant
now compared to five years ago, when Android was first introduced?

Obviously, the platform has matured considerably in that time. It has also
greatly benefited from its open source approach by fostering significantly
faster innovation compared to closed, proprietary operating systems. Take a
look at a first-generation iPhone compared to the iPhone 5. While the hardware
has vastly improved, the primary user interface is nearly identical. Consider

V413HAV report erratum • discuss


Introduction • xii

the differences between Android 1.0 running on a G1 phone and Android 4.2
running on a Nexus 4. The differences are striking. The user interface, hard-
ware support, design aesthetics, and everything but the original design prin-
ciples have rapidly evolved for the better. One benefit from this co-evolution
of hardware and software is that you can do things on a modern Android
device that was the stuff of fiction five years ago. To think that on your Android
device you can now do computing on a scale that was the exclusive domain
of desktop PCs for the last thirty years is awe-inspiring.

This evolutionary path is also manifested in Android application development


tools. Once clunky and incomplete, the Android SDK and Eclipse plug-ins
are finally capable of stable, team-based, test-driven development. While the
user interface construction toolkit could still use more polish, every other
aspect of the typical Android development and emulation on a desktop PC is
polished and professional.

One of the most exciting aspects of Android programming, testing, and


deployment is that its application development life cycle can now be done
directly on the Android device. This is a big deal. When compared to other
mobile operating systems that require an expensive PC outfitted with a decent
processor and plenty of RAM to run the target emulator, the projects discussed
in this book require only your Android device. When you code and run
applications on the same device, it greatly accelerates the development process,
just as it did during the desktop PC era.

Let’s also not forget that, like a desktop computer, Android’s home screen
can be highly customized and extended via custom wallpapers, animations,
icons, folder actions, transition animations, and much more. This degree of
personalization allows you to make your Android device fit your aesthetic
values, daily workflow, and communication and notification preferences, not
the other way around. Third-party extensions and widgets also help push the
envelope of what is possible, further contributing to Android’s success and
dominant market position.

Who This Book Is For


This book is for anyone who is interested in doing much more with an Android
device than downloading and using apps from the Google Play store. If you
love your Android phone or tablet and you love to tinker with technology, this
is the perfect book for you. And while prior programming experience is not
required, it will be helpful to understand some of the scripts that we will
create in the chapters ahead.

V413HAV report erratum • discuss


Requirements • xiii

Requirements
This is a book about Android, so it should come as no surprise that a must-
have requirement is an Android phone or tablet running Android OS 4.2
(known by its friendly code name Jelly Bean) or newer. The screenshots used
throughout this book were taken on a Galaxy Nexus phone and Nexus 7
tablet.

In addition to the Android phone or tablet, you should have an active account
on the Google Play store, since a good portion of the software used in this
book is exclusively distributed via the Google Play service.

Lastly, while it’s not required, I strongly recommend you obtain a quality
Bluetooth keyboard known to be compatible with the Android OS. I have yet
to use a Bluetooth keyboard that could not be paired with Android, but key-
boards designed specifically with Android in mind are optimal since they often
have special keys associated with functions such as play/pause music, volume
control, toggle between applications, lock the screen, and so on. My current
favorite mobile Bluetooth keyboard is the Logitech Tablet Keyboard for
Win8/RT and Android, shown in the following figure.1 It is a full-size keyboard
and thus larger than other mobile Bluetooth keyboards that have a smaller
footprint or fold in half for greater portability. Plus, Logitech’s full-size key-
board combined with the protective cover doubles as a phone or tablet stand.

Figure 1—The Logitech Tablet Keyboard for Win8/RT and Android

1. http://www.logitech.com/en-us/tablet-accessories/android/tablet-keyboard-android-win8-rt

V413HAV report erratum • discuss


Introduction • xiv

While you are understandably not going to be able to use this keyboard in a
cramped moving vehicle such as a bus or train, it works perfectly fine sitting
on an airplane fold-down seat tray or desk. And since I’m usually bringing
along a backpack during my commutes, the Logitech keyboard adds practi-
cally no additional weight or bulk to the bag. Besides, you will find that the
keyboard is a sanity saver when editing code or documents on the Android
device.

So, that’s it—a phone or tablet, an active Google Play account, and maybe an
Android-compatible Bluetooth keyboard. For folks like me who have been
around since the dawn of the personal computer era, it is simply amazing to
think how far we have come in the past forty years and how much further
we’ll go in the next forty years.

Jailbreaking and Rooting


Unlike traditional desktop operating systems, mobile OSs like Android and
iOS are locked down in such a way so that the system-level files cannot be
tampered with by ordinary users. This keeps the device more secure by pre-
venting malicious applications from modifying system files without the user’s
knowledge. Similarly, it prevents the user from altering these files.

Jailbreaking is a term used in the mobile device market to mean a procedure


that allows users to bypass the normal operating system–level restrictions,
typically to gain root-level access (rooting the device). Once root access is
obtained, the user or application has full read-write access to all aspects of
the operating system files. This allows modification of the device’s behavior
in ways that weren’t originally intended by the OS developer.

While Android OS tinkerers can benefit from rooting a device by understanding


the internal workings of the OS better, average users could be putting the
contents and operation of their phones’ security at risk if they are untrained
in the various aspects of mobile OS security best practices. In the early days
of Android, when many features were immature or missing, jailbreaking and
rooting were more attractive, since doing so provided power users with a
degree of customization that matched their needs. These custom modifications
could range from modifying system-level virtual private network (VPN) software
stacks to changing the look and feel of the home screen.

Android today is a much more mature operating system, so many of these


limitations have a viable and more secure alternative. The projects in this
book do not require jailbreaking or rooting your device. Unless you are a
security researcher or a technology tinkerer who likes to crack things open

V413HAV report erratum • discuss


What’s in This Book • xv

to see how they work, there is no overwhelming reason for average users to
consider jailbreaking and rooting their Android devices.

What’s in This Book


Now that we have packed our bags for the journey, let’s look at the road map
we’ll use to progress along the trail.

In the first part of the book, we will look at the variety of options we have to
customize our Android experience. The home screen, lock screen, widgets,
backgrounds, icons, and touch behaviors can all be personalized to your liking.
Unlike some mobile operating systems that enforce a structured, inflexible
design aesthetic, Android offers desktop-like customization in a mobile
package. We will dive into specific examples for home screen renovation. We
will also take a look at extending our Android experience by calling upon a
variety of Android’s hardware capabilities, such as using the headphone jack
to transform our Android applications into better, more convenient, and
information-rich wearable-computing user experiences.

In Part II, we will dip our toe in the automation waters by taking a look at a
very powerful application called Tasker. We will use Tasker to automate sev-
eral personal workflow needs and get introduced to some basic conditional
programming and control flow while we’re at it. We will also delve further into
the programming landscape with the introduction of Scripting Layer for
Android (SL4A). SL4A will allow us to write scripts in Python, Ruby, and
other popular interpreted languages that will execute on Android and give us
access to most of the system-level calls exposed by the Android SDK. We will
conclude the Explore section of the book by actually programming Android
using the native SDK. But instead of using a personal computer loaded with
the Android SDK, emulator, and related development tools, we will write,
compile, test, and deploy these native applications entirely on our Android
phone or tablet.

In Part III of the book, we will apply what we learned in the first two parts by
first creating a custom Android widget entirely on the device—no PC required.
The final set of projects in the book will wrap these scripting and automation
technologies in friendly user interfaces. These projects will show the versatil-
ity and automation opportunities that Android has to offer. The book also
includes appendixes that review a variety of programming tools that run on
the Android platform, as well as offer additional web resources to further your
own project ideas.

V413HAV report erratum • discuss


Introduction • xvi

By the end of the book, you should be well prepared to continue the journey
on your own to create an Android experience that perfectly complements your
information-interaction lifestyle.

Online Help
Many websites are devoted to the dissemination of Android news, reviews,
hacking, modding, and programming. Check out Appendix 1, Android Pro-
gramming Tools, on page 187, for a list of some of my favorites. It should go
without saying that for Android development, Google’s http://developer.android.com
website offers the official word on Android application development. This isn’t
just a repository of bland technical documentation but a wealth of useful and
well-written articles, tutorials, and tech notes from the folks responsible for
various portions of the operating system. It’s a resource that any serious
Android developer should have permanently bookmarked.

There are a number of footnotes in the book featuring web links to more online
resources. I also encourage you to post specific questions or comments about
the ideas presented in the book at the book’s web forum. Should you happen
to spot an error, feel free to mention it on the book’s website errata page.
You’re also welcome to contact me directly via my [email protected] email
address or follow me on Twitter @mriley. I look forward to hearing from you!

With that, we’re ready to take a look at all the things we can customize in a
nonrooted device running the stock Android 4.2 or newer operating system.

Mike Riley
[email protected]
November 2013

V413HAV report erratum • discuss


Part I

Customize

V413HAV
CHAPTER 1

Getting Started
Today’s smartphones are amazing devices. They are such powerful and
capable computing devices that they have even replaced traditional desktop
personal computers for some people. And like traditional desktops, one of the
most exciting aspects of the Android platform, especially when compared to
other mobile operating systems, is its ability to be highly customized. This
customization goes beyond just wallpaper and icon replacements. You can
use Android to create custom tasks, scripts, workflows, and behaviors that
can’t be done easily on most other mobile platforms.

In this book we’re going to go beyond simply locating and installing commercial
Android applications that provide generic functionality to fulfill your needs.
But before we can start crafting scripts and applications that do what generic
Android applications cannot, we need to evaluate key features of what an
Android device has to offer. Then we can determine what to look for in the
Google Play market. If we can’t find what we’re looking for, we can build it
ourselves.

In this chapter, we will take a look at some of these key aspects before decking
out your phone or tablet with themes, widgets, and applications that might
not optimally suit your mobile lifestyle needs.

1.1 Analyzing Your Mobile Lifestyle


Before you can begin building a solution, you need to determine the problem
to be solved. Even though today’s high-end smartphones are more powerful
than desktop computers were only a few years ago, this power is often not
fully harnessed by users until they learn how to leverage all facets of the
device. To do that, compare how you use your smartphone today with how
you would like to use it in the future.

V413HAV
V413HAV report erratum • discuss
Chapter 1. Getting Started •4

If your Android device is a phone, do you use it primarily for voice calls or
texting? If you use an Android tablet, is it used mostly for reading ebooks or
for surfing the Web? Deciding where you spend the most time with your device
will help narrow down what functionality can be enhanced to improve your
efficiency and satisfaction with the Android OS.

Think about how much time you spend with an application. Is it because it
is so helpful that you can’t imagine life without it? Or is it because the
application is so cumbersome and nonintuitive that it sucks up a substantial
amount of time while you’re fighting the interface? Do you find yourself run-
ning the same type of task over and over again?

If you had the chance to re-create your most frequently used applications,
what would you change about them? Do you have special needs that are not
addressed in these apps?

Here is a personal example. I am bound by train schedules for my commute


into work. As such, an important feature that I needed from my Android
phone was a way for me to know the current time without having to dig into
my pocket for my phone and fumble with the security unlock code. Just
imagine how cumbersome that would be wearing thick gloves on a subzero
Chicago winter morning. Since I was already wearing earbuds to actively listen
to tech podcasts during my commute, hearing the time spoken was a much
more advantageous solution than the visual clock display.

At first, I wrote a simple talking clock app using the Android SDK but found
it to be inflexible when it came to making tweaks to the routines. If I discovered
a bug or came up with an idea to extend the program’s functionality, I had
to wait until I got home to fire up my computer, run Eclipse, spin up an
Android emulator, load the project, make changes to the codebase, go through
a test/debug cycle in the emulator, and then push the compiled .apk file to
my Android phone via the Android Debug Bridge (ADB). All that work for a
few minor tweaks! Needless to say, there had to be a better way. Hence, the
journey I’ll take you through in this book mirrors my own iterations that best
suited my mobile lifestyle needs.

If you’re like me and you live in the post-PC era by deprecating your desktop
or laptop computer for a phone or tablet alternative most of the time, your
mobile lifestyle is all-encompassing. My phone is always by my side during
my waking hours and on my nightstand when I sleep. Likewise, my tablet is
with me during my commutes and anytime I’m driving somewhere where I
will be away from home longer than an hour. Just as noteworthy to-dos pop
into my head while on the go, ideas for enhancements to existing Android

V413HAV report erratum • discuss


Analyzing Your Mobile Lifestyle •5

apps I have written have to be captured at that moment before they are lost
into the ether of the day’s demands.

Having the flexibility to make these changes on the fly has been about as
game-changing for me as when I bought my first home computer in the 1980s
(an Atari 400 with its craptaculous membrane keyboard) and then could write
my own apps without having to wait for computer lab time at school. That
freedom and flexibility changed my life back then, and as the Android platform
matures with the ability to develop apps on the device rather than a hulking
piece of hardware, that life-changing experience is resurfacing.

To put yourself in a mobile lifestyle frame of mind, here are some questions
to ponder when considering how you use your Android device for your own
customization opportunities:

• What hours of the day do you use your phone or tablet? If you respond
“All the time,” what are the time ranges that you use the device the most?

• What applications do you spend the most time using? If you’re not sure,
Android’s Data Usage and Running apps (shown in the following figures)
are accessible via the Android Settings application.

Figure 2—An example of Android’s data Figure 3—A list of currently running
usage applications

V413HAV report erratum • discuss


Chapter 1. Getting Started •6

While not a true reflection of time spent with each application, these two
measurements can help you to a certain degree by showing you which
programs consume the most bandwidth and power. These data collections
can help you become more aware of which applications are frequently
running (whether you’re aware of them doing so in the background or
not).

• What repetitive tasks do you perform with your device that would save
time if you could automate these efforts? For example, I used to make an
effort to turn on my phone every morning, turn on the WiFi radio, launch
my podcast application (I’m currently a fan of the DoggCatcher Podcast
Player1), and wait for the application to download whatever podcasts were
available. When done, I would then turn off the WiFi radio to conserve
battery. If I forgot or ran out of time, I wouldn’t have any new podcasts
to listen to on the way to work. By the way, I no longer do this manual
process since I’ve scripted the entire procedure to kick off thirty minutes
before I wake up. I’ve also created automated tasks to grab the latest news
and weather to read to me after the clock alarm awakens me. We’ll explore
how to write your own scripts and tasks later in the book.

• What dream applications or widgets do you wish you had but haven’t
seen in the Google Play store? Be as specific as possible. Do you want an
application that will wake you up, turn on the lights, and start brewing
a pot of coffee at the same time? After reading this book and another book
I wrote called Programming Your Home [Ril12], also published by Pragmatic
Bookshelf, you will have the knowledge necessary to bring an automation
example like this to fruition.

With these thoughts in mind, let’s take a closer look at some of the more
interesting personal automation ideas we could build upon.

1.2 Mobile Personalization


After you have considered what opportunities for automation exist, start
brainstorming how to make those ideas come to life. You will discover that
the more you think about the improvements that customized automation can
bring, the faster new program ideas will flow. Some of the automated scripts
and applications that I have created on my Android devices include the follow-
ing examples:

1. https://play.google.com/store/apps/details?id=com.snoggdoggler.android.applications.doggcatcher.v1_0

V413HAV report erratum • discuss


Mobile Personalization •7

• Parse SMS alerts for keywords and react accordingly. If you’re a system
administrator, you could parse SMS messages for the phrase “Server
down” and set off a klaxon-style alarm on your phone or tablet.

• Grab RSS news feeds and repackage them for your own personalized news
broadcast. Set your Android device to connect to the Internet at specific
times throughout the day to fetch RSS feeds, parse them, and convert
the text to speech. Then have it read the news stories to you during your
commute to and from work.

• Transmit Wake-On-LAN (WOL) packets in the middle of the night to


computers on your LAN or home network. This will wake them up, run
backups on their users’ home directories, and send a backup report of
success or failure to your Android device. Then let the computers go back
to sleep.

• Have your Android phone automatically turn off all radios except mobile
voice calls and set your display to night mode from the time you go to bed
to the time you wake up in the morning. To help you fall asleep, have
your phone play soothing music or sounds of nature (seashore, forest,
meadow, rain shower, and so on) for twenty minutes, giving you enough
time to peacefully fall asleep.

• Take a photo with your phone or tablet and have that image automatically
cropped, filtered, resized, and posted to your online photo album or blog.

• Divert inbound phone calls based on caller ID information to voicemail


or automatically forward the call to a secondary number (such as a Google
Voice number that offers message transcription services) depending on
time of day or level of personal importance.

Once you have a list of needs in mind, you can start to define what is neces-
sary to bring these ideas to fruition. If someone hasn’t already done the work
for you and posted the results of their efforts online or in the Google Play
store, you have a few more factors to consider before diving in and expending
the time and effort needed to bring your ideas to life.

Consider Your Skill Level


If you consider yourself more of a power user than a programmer, you will
find that most of the applications and tools mentioned in this book are easy
and approachable. While some of the scripts require knowledge of the Python
or Ruby language, it isn’t essential that you know how to program in either.
Tasks can be created with a minimum of programming knowledge, but it

V413HAV report erratum • discuss


Chapter 1. Getting Started •8

certainly helps if you have some coding skills and are willing to learn new
things.

If you’re already a programmer familiar with object-oriented languages like


Java, picking up the necessary skills to develop Android applications is
straightforward. Several books are available, and hundreds of text-based and
video tutorials exist online to help get you started. As you will see later in this
book, you can build applications that rival natively constructed commercial
Android programs using these tools built for programmers and nonprogram-
mers alike.

Features vs. Time


When starting with an idea, I find it is best to begin with a prototype that can
help crystallize how the application should behave. If I encounter constraints
or roadblocks that simply cannot be overcome with the prototype, I make a
note of these issues so I can evaluate whether those features are worth the
effort to implement using more time-consuming native development
approaches.

There are also times when writing automated tasks or scripts accomplishes
enough of the intended objective that writing a native application is no longer
necessary. This is particularly true if the script or workflow you are creating
is targeted for your specific mobile lifestyle need. But what I have often dis-
covered with my workflows is that as I show my creations to others, they
excitedly ask whether they can have something similar. That’s where this
book comes in. As the classic Chinese proverb says, “Give a man a fish, and
you feed him for a day. Teach a man to fish, and you feed him for a lifetime.”
Let’s go fishing.

1.3 Next Steps


Keep the ideas presented in this chapter in mind as you read this book. As
you learn how to make Android perform automated tasks, consider how these
novel tasks can be expanded to make your life easier. The more you practice
creativity, the more creative you will become.

In the next chapter, we will dive into our first layer of customization by mod-
ifying the look and feel of the Android home screen. With the help of a handful
of utilities available from the Google Play store, we can transform the default
Android user interface into a whole new experience.

V413HAV report erratum • discuss


CHAPTER 2

Personalizing Your Home Screen


For those old enough to remember the days of Windows 3.0, a key differentia-
tor between that GUI-based operating system and the competing Apple Mac
OS 7 was that Microsoft’s offering allowed third-party shells to transform the
look and feel of the Windows experience. As time went on and Microsoft’s
dominance was assured, this level of customization was practiced less fre-
quently but could still be applied for those who preferred an alternative user
interface.

Within the mobile space scenario, Google’s Android has replaced Apple as
the dominant operating system, in part because of the same openness to
customizing the user experience. A variety of home-screen shells, better known
as launchers, are available through the Google Play marketplace that can
swap out default home-screen graphics, icons, and behaviors. And in contrast
to Apple’s iOS platform, Android allows the placement of onscreen mini-
applications known as widgets to alter the stock Android UI. Pushing the
envelope a bit further are what I call floaters. These are Android applications
that run in a resizable desktop-like window that can multitask and hover on
top of the home screen or other full-screen Android programs.

In this chapter, we will take a look at several home-screen customization


approaches. We will also review several widgets in preparation for building
our own later in the book. Then we will assess some of the more popular
floater applications as well as explore a few hardware and software enhance-
ments that can be used to further manipulate Android’s standard application
launching interface. Lastly, we will put all these pieces together to create an
emulated Windows Phone or Mac desktop user experience running on an
Android device.

V413HAV report erratum • discuss


Chapter 2. Personalizing Your Home Screen • 10

2.1 Launchers
The stock home screen that comes on the standard Google Nexus devices
offers a crisp, clean interface. But if you don’t like how it looks or want to
remove the Google search bar widget that refuses to budge when you try, you
have several alternative approaches to choose from. These replacement home-
screen layout and theme applications, called launchers, are available for
download directly from the Google Play store. As the name implies, launchers
can be used to launch applications. But they can also be used to customize
everything from the look of icons to the transition animations that are dis-
played when moving between screens.

Some device manufacturers have created their own custom launchers to


enhance and differentiate their Android devices. These include Samsung’s
TouchWiz1 and HTC’s Sense.2 This degree of customization demonstrates a
major advantage that Android has over competing mobile operating systems.
This also helps to accelerate user experience innovations because Android
offers a platform where experimentation is not only possible but embraced.

Most of the commercially available launchers offer a free version to play with
that are either ad-banner supported, restricted in features, or constrained to
a certain degree of customization. If customers like what they see, they are
encouraged to reward the launcher’s creator with a paid upgrade that will
remove ads and/or unlock additional features. The nice thing about these
commercial launchers is that they can easily be installed just like any other
program that can be obtained from the Google Play store. Once downloaded
and installed, the replacement launcher will ask for your permission to always
be used as the default launcher. You can also choose to run a launcher once
before making the launcher replacement a global change. At the time of this
writing, the most popular launchers on Google Play are ADWLauncher EX,3
Apex Launcher Pro,4 GO Launcher EX,5 and Nova Launcher Prime.6 Let’s take
a brief look at each of these to see what they have to offer and what differen-
tiates one from the other.

1. http://en.wikipedia.org/wiki/TouchWiz
2. http://en.wikipedia.org/wiki/HTC_Sense
3. https://play.google.com/store/apps/details?id=org.adwfreak.launcher
4. https://play.google.com/store/apps/details?id=com.anddoes.launcher.pro
5. https://play.google.com/store/apps/details?id=com.gau.go.launcherex
6. https://play.google.com/store/apps/details?id=com.teslacoilsw.launcher.prime

V413HAV report erratum • discuss


Launchers • 11

ADWLauncher EX
One of the most downloaded launchers on the market, ADWLauncher EX’s
main claim to fame is that it runs on platforms as far back as Android OS
version 1.6. Even on that early Android release, ADWLauncher EX offers the
same kind of eye candy and customization features found on later Android
releases. However, maintaining this visual compatibility comes at the price
of a slightly larger application installation size compared to other launchers.

Pros

• Runs on the Android operating systems as far back as version 1.6 (aka
Donut)
• Fair number of customization options and graphical flourishes, such as
page transitions, icon adjustments, and app organization styles

Cons

• Larger installation footprint compared to other third-party launchers


• Not yet optimized for Android 4.2 and newer
• Can be problematic with some widgets

Apex Launcher Pro


This launcher has become popular among the Android 4.0 crowd, partly
because it doesn’t run on any Android versions older than the 4.0 release.
As such, the install footprint is tiny in comparison to something like
ADWLauncher EX. Apex Launcher Pro can also use launcher themes created
for competing launcher platforms like ADW and Go Launcher.

Pros

• Optimized for Android 4.0 and newer


• Tiny install footprint
• Can import themes from several competing third-party launchers

Cons

• More expensive than other third-party launchers


• Not quite bleeding edge, but good enough to take advantage of the latest
themes and design aesthetics that Android 4.2 utilizes

GO Launcher EX
With more than a million installations since its release into the Play market-
place, GO Launcher EX is by far the most popular on Google Play and has

V413HAV report erratum • discuss


Chapter 2. Personalizing Your Home Screen • 12

the largest variety of third-party add-ons and inventive creations formatted


for the program’s graphic templates. It’s also free, but at a big price in the
form of in-app advertising. While other launchers offer free, ad-supported
versions, most of the alternatives offer a paid upgrade version that eliminates
in-app advertising along with expanded graphic options.

Pros

• It’s free.
• This is the most popular launcher on the market, with a thriving add-on
and custom theme market (more than 5,000 and counting).
• It runs on Android 2.0 and newer.

Cons

• In-app push advertising clutters the experience.


• It doesn’t consume themes built with other third-party launchers.

Nova Launcher Prime


TeslaCoil Software’s Nova Launcher Prime
(shown in the figure here) is one of the
newest Android launcher programs on the
market. Like Apex Launcher Pro, Nova
Launcher Prime runs only on Android 4.0
and newer devices. As such, its minuscule
install size coupled with its ability to import
ADW or Go Launcher icon themes elevate
it beyond a casual launcher replacement.
It’s one of the more expensive launchers
analyzed in this chapter, but I find that it
is also one of the most flexible and intuitive-
ly designed.

Nova Launcher Prime is my personal


launcher of choice and the one I used
throughout this book. And because this
book assumes you are also using a device
running Android OS 4.0 or newer, Nova
Launcher Prime is an even easier top recom-
mendation to make.
Figure 4—Nova Launcher Prime
is my preferred launcher.

V413HAV report erratum • discuss


Launchers • 13

Pros

• Optimized for the Android 4.0 user experience


• Flexible yet intuitive user interface options
• Can import and use ADW and Go Launcher icon themes
• Built-in unread count badges for Gmail, missed calls, and SMS

Cons

• Comparatively expensive

Who Can You Trust?


While these launchers offer a fun and visually exciting way to customize the
look and feel of the home screen and icons that populate the screen, they
require an extraordinary level of access to a number of areas within the
Android operating system to do their magic. Even though a majority of Android
applications usually need only two or three permissions (such as Internet
access, read-write access to the SD card, and so on), several of the Android
launchers featured in this chapter require a whole host of OS-level permis-
sions, from reading your contacts, text messages, call log, and email to having
full network access. Given such broad access to your data and a connection
to a network, untrustworthy launchers could harvest that data for their own
nefarious purposes.

Fortunately, it’s unlikely that the more popular launchers highlighted in this
book would be engaging in such practices since they are used by so many
people; the likelihood is small that security-conscious customers using these
products would be monitoring the application’s network interaction for any
funny business. Yet while companies that create these launchers are seeking
commercial gain through the sale of their application, the more popular a
launcher becomes, the more likely unscrupulous hackers could seek out and
exploit security flaws in the launcher by exploiting unintentional vulnerabilities
in the target launcher application.

The lesson to be learned with this array of launchers is that Google could
step up its game and bake launcher customization within the Android OS.
Not only will this alleviate security concerns (that these third-party launchers
have unfettered access to so many sensitive areas of the phone or tablet), but
it will also help to standardize on theme formats. Instead of being locked into
one vendor’s interpretation of what a launcher theme should consist of, Google
could help set a universal protocol that Android users and independent theme
designers could follow. Until then, we’re stuck with entrusting these third-
party providers with our device’s security.

V413HAV report erratum • discuss


Chapter 2. Personalizing Your Home Screen • 14

Launchers can be combined with custom wallpaper images, icons, and screen
transitions to create a new level of personalized artistic expression among a
new generation of mobile connected users. Just as car exteriors were
customized during the mid-1960s through the ’70s by that generation’s youth,
this design trend has been reborn in the mobile generation. Even more levels
of customization can be realized using widgets. Let’s take a closer look at this
standout feature that is part of the Android OS experience.

2.2 Widgets
A major distinction between a desktop computer and a mobile OS such as
Android is the way people interact with information on the display. A desktop
offers considerably more screen real estate (even more so with multiple
monitors) than is typically offered on a mobile display. As such, running
dozens of windowed applications on a mobile device isn’t very practical. Yet
the power of a multitasking OS such as Android allows for many programs
to be running at the same time.

Android has solved this constraint somewhat with the creation of widgets.
Widgets are small graphical applications anchored to the home screen that
can display data in a space as small as a single icon or expand to take over
most of the screen. In this section, we’ll take a look at how to select and use
widgets, as well as sample a few of my favorite Android widgets.

When widgets were introduced in the early days of Android, they were one of
the most defining features of the OS when compared to competing mobile
platforms. Since then, widgets have found their niche as a collection of useful
albeit limited views often for larger host applications.

For example, many media players available for sale on the Google Play store
include widgets of various sizes that distill basic functions such as play/pause
and forward/rewind onto screen areas that span anywhere from one-by-two
to four-by-four tiles. Other widgets offer scrolling news-ticker-style updates
from RSS feeds, server status, and to-do list reminders, among other things.
In addition to the widgets available on the Google Play store, Android ships
with its own collection of widgets to support the variety of Google applications
on the phone.
Discovering the widgets installed on your Android device and adding a widget to
your home screen is easy. To view the widgets installed on your phone on a
standard Android 4.2 launcher configuration, select the Applications group icon
from the lower center of the screen. This will display icons of all the visible pro-
grams on your device. From this screen, select the Widget tab to view the installed
widgets as shown in Figure 5, Android widgets selection screen, on page 15.

V413HAV report erratum • discuss


Widgets • 15

Choose a widget by long-pressing the widget’s


icon. This will transform the icon into a float-
ing representation that you can select and
drag on your Android’s home screen.
Depending on the type of widget, a preference
settings screen may appear after you have
released the widget’s floating icon for place-
ment. This settings screen may be specific to
that widget or, if the widget is a window to a
full Android application, display the settings
screen for that host program. And in Android
4.2 and newer, widgets can be resized to
consume more or less space on the home
screens. This flexibility adds an even higher
degree of home-screen customization, allowing
you to tweak exactly how you want your
screen to appear.

Lock-Screen Widgets
While the original intent of the lock screen Figure 5—Android widgets
was to prevent the phone from accidentally selection screen
launching apps or dialing numbers while
jostling in your pocket, lock screens are increasingly important. Mobile devices
have become containers of personal information, and the content should be
protected with the same security applied in the physical world. But as secu-
rity increases, convenience decreases. So, something as simple as checking
your calendar can become a time-consuming dance of unlocking your phone,
scrolling to the calendar icon, launching the program, scrolling to the
appointment, and expanding the view for details.

To offset this kind of inconvenience, Google introduced a widget enhancement


feature for the lock screen called, you guessed it, lock-screen widgets. The
lock-screen widgets that are bundled in the standard Android 4.2 OS allow
you to view items such as your calendar, email, and contacts and to even
launch the Camera app without having to unlock the screen.

To select a lock-screen widget, swipe to the left while the lock screen is
enabled. This will display a blank grid with a plus symbol in the center, as
shown in Figure 6, Adding widgets to the lock screen, on page 16. Select the
plus symbol, and a list of widgets that are lock screen–compliant will be dis-
played, as shown in Figure 7, A selection of lock-screen widgets, on page 16.

V413HAV report erratum • discuss


Chapter 2. Personalizing Your Home Screen • 16

Scroll through the list to choose the one you want and place it on the lock
screen via the same procedure as placing a regular widget on the home screen.

Figure 6—Adding widgets to Figure 7—A selection of


the lock screen lock-screen widgets

Considering the number of home-screen widgets available in the Google Play


store, the choice of lock-screen widgets is not nearly as expansive. This is
surprising considering how easy it is for developers to take existing widgets
and convert them to be lock screen–compatible.

Perhaps as a result of this dearth of lock-screen widgets compared to home-


screen widgets, Android engineer Roman Nurik created the DashClock widget.7
This innovative replacement for the standard Android lock-screen clock
application can host additional details in neatly defined groupings of informa-
tion. DashClock also solves the problem, related to both home-screen and
lock-screen widgets, of when your screens start filling up quickly, requiring
you to scroll back and forth to look for quick tidbits of information.

7. https://play.google.com/store/apps/details?id=net.nurik.roman.dashclock

V413HAV report erratum • discuss


Widgets • 17

The other advantage that DashClock offers is a very easy way to hook into
its API so that third-party data sources can be displayed in DashClock’s
container.8 Roman released the DashClock source code under the open source
Apache License 2.0, making it a hit among developers who have rewarded
Roman’s efforts with a thriving number of add-ons. These range from battery
and dialing extensions to word-of-the-day and Facebook message counts.

Of course, with all these extensions, you have to be cautious about the type
of lock-screen enhancements you install. As is the case with something like
the Gmail or Calendar lock-screen widget, DashClock extensions might be
exposing data that you don’t want to display on a pocket billboard. DashClock
also has access to permissions such as contacts, email, and location that can
be polled by it and the extensions it hosts. So, unless you implicitly trust
whatever extension you host within DashClock, be wary of what you install.

My Favorite Widgets
I try to keep my widget count to a minimum
(see the figure here). Too many widgets,
especially those polling for frequent network
updates, can impact performance and battery
life. I also stay away from the widgets with
lots of graphical flourishes and large screen
footprints because I find them distracting and
overstepping their intention of quickly
assessing the data they are trying to convey.
That said, here are some of the widgets I pre-
fer.

• Calendar

This is the widget component of Google’s


calendar application that is included with
Android running Google applications. It’s
helpful for taking a quick glance at
upcoming scheduled events.

• Moon Phase Pro


Figure 8—These are a few of my
Being a child of the 1960s and having
favorite things.
early memories of watching a blurry tele-
vision screen showing Neil Armstrong step

8. http://code.google.com/p/dashclock/wiki/API

V413HAV report erratum • discuss


Chapter 2. Personalizing Your Home Screen • 18

onto the surface of the moon has endeared me to all things space. Moon
Phase Pro9 created by developer Udell Enterprises keeps me in touch with
my fascination with celestial bodies. In addition to the main program that
displays the monthly phases of the moon along with other interesting
statistics, the program comes bundled with several widgets of various
sizes and levels of detail.

• Headset Button Controller

I use this application each time I press the button on my Android headset.
Created by Android developer Christoph Kober, Headset Button Controller
essentially allows you to assign different actions to each type of headset
button press.10 Those actions can span from running scripts and applica-
tions to reassigning behaviors to other button presses. The program
includes a widget that allows you to quickly switch between different
headset button profiles. We will explore in greater detail and make use
of this application in the next chapter.

• Smart Tools Flashlight

The Smart Tools bundle is a helpful collection of fifteen measurement


tools ranging from virtual rulers and protractors to metal detectors and
magnifiers. The program includes a helpful Flashlight widget that turns
on and off the rear camera light (if you have one on your phone or tablet)
with the touch of the Flashlight widget icon. This has helped me more
than a couple times while searching for keyholes and safe walkways and
for paper-based reading at night. Since I always have my Android phone
with me, I always have a flashlight with me as well thanks to this useful
widget.

• Python Interpreter

This widget provides a shortcut to the Python interpreter hosted within


the Scripting Layer for Android (SL4A) program. Besides Python, SL4A
can host a number of other different languages within the Android envi-
ronment. We will learn much more about the SL4A in Chapter 5, Scripting
with SL4A, on page 63.

• Pomodoro Clock Widget

This is my second favorite widget and one I built myself. Touching this
widget activates a Pomodoro countdown timer. I will tell you more about

9. https://play.google.com/store/apps/details?id=com.daylightmap.moon.pro.android
10. https://play.google.com/store/apps/details?id=com.kober.headsetbutton

V413HAV report erratum • discuss


Floaters • 19

Pomodoro timers and walk you through the process of building this widget
in Chapter 7, Tasker Pomodoro Widget, on page 93.

• Check Mail Widget

This is my favorite widget and, like the Pomodoro Clock widget, is also
one I built myself. When tapped, the Check Mail widget will check for new
email and speak any new unread messages received. I find that this widget
and the corresponding script it executes is crucial for the hands-free
reporting of new mail messages. We will be building this widget and the
backend script that powers it in Chapter 8, Messaging Projects, on page
115.

Now you should have a pretty good idea of the types of custom application
launchers and widgets that Android has to offer. In the next section, we will
take a look at a special type of Android application that gives your Android
device a retro feel by harkening back to the days of traditional PC-based,
window-driven GUIs.

2.3 Floaters
There is another category of Android applica-
tions that can be displayed on the screen
within a movable window. I call these pro-
grams floaters. Floaters behave just like a
window in a modern desktop computing OS.
Most can be resized, minimized, and maxi-
mized, and some even support multiple
instances, allowing multiple windows on the
screen at the same time. See the figure here.

The advantages of using floaters are not as


great as you might expect. They really don’t
work all that well on an Android phone with
a small display. Screen real estate is already
at a premium, and managing windows on top
of an already limited overall display field can
get annoying after a while. There’s also the
dissonance problem of merging an old GUI
desktop application metaphor onto a modern
mobile operating system. It breaks up the
flow, and you may find yourself spending more Figure 9—Several floaters in action

V413HAV report erratum • discuss


Chapter 2. Personalizing Your Home Screen • 20

time moving around and organizing windowed applications than actually


interacting with the data they contain.

That said, there are a few benefits. Let’s say you’re watching a video and need
to check and respond to email. Normally you would have to pause the playback
to do so. Using a floater media player, you can just resize the window while
perusing your messages and then expand the playback to full screen without
missing a moment of content. There’s also the coolness and geek credibility
factors to be able to show colleagues something they might not have thought
possible on a mobile device. Lastly, floaters work rather nicely on a 10-inch
Android tablet thanks to the much larger screen size that gives you the ability
to effortlessly move and resize windows. I tend to use floaters most frequently
on these types of large-screen devices.

While quite a few floater-style applications are available in the Google Play
store, here are a few worthy of a closer look:

• AirCalc11

AirCalc is a simple yet free calculator for Android. It also provides a nice
introduction to floaters and is a great way to determine whether your
Android device supports the app screen overlay techniques employed by
most floater programs. AirCalc can be resized, minimized, and maximized
just as you would expect a traditional windowed application to behave.

• AirTerm12

AirTerm is another program written by MBFG (short for My Boyfriend is


a Geek), the same folks behind AirCalc and several other floaters available
from the Google Play store. AirTerm incorporates KBOX,13 a full-featured
Busybox clone for nonrooted Android devices.14 KBOX includes useful
Unix-oriented command-line utilities such as scp, ssh, vim, wget, and
more. While not as complete as something like Terminal IDE (refer to
Appendix 1, Android Programming Tools, on page 187, for more information
on this tremendously useful Android utility), AirTerm can help out in a
pinch. I typically call upon AirTerm on my tablet when simultaneously
administering several Linux servers at the same time.

11. https://play.google.com/store/apps/details?id=com.myboyfriendisageek.aircalc
12. https://play.google.com/store/apps/details?id=com.myboyfriendisageek.airterm
13. http://kevinboone.net/kbox.html
14. http://www.busybox.net

V413HAV report erratum • discuss


Floaters • 21

• DICE Player15

DICE Player is a free (donations encouraged), full-featured media player


for Android. In addition to supporting a variety of playback formats, DICE
Player includes the ability to convert the normal full-screen playback
mode into a floating pop-up player. The windowed player can be resized
like any other floater-style application. One nifty aspect I like about the
DICE Player is its ability to speed up playback without altering the pitch.
This allows me to watch screencasts twice as fast without changing the
pitch of the audio. A typical scenario on my tablet is to have DICE play
back a screencast in double time while I have Terminal IDE or AirTerm
open, interacting with a server running the configuration being presented
in the screencast. It’s the ultimate post-PC learning experience.

• Overskreen16

Overskreen is another MBFG application that brings the floater technique


to the standard Android web browser. Because of this, Overskreen is a
no-frills browser that can’t compete with the likes of Chrome or Firefox.
Still, its floater properties come in handy when searching the Web or
referring to a website while writing a document. It sure beats the alterna-
tive tap-and-swipe dance common when switching between running
Android programs.

• Stick it!17

Stick it! is another Android media player that, like DICE Player, provides
video playback within a pop-up window. However, unlike DICE Player,
Stick it! offers a neat feature on higher-end Android devices called Multi-
View. This essentially allows for multiple windows to play back different
video content at the same time. It’s an awesome technology demo, but I
honestly haven’t used MultiView in many real-world scenarios. And as
you can imagine, playing several videos at the same time can be rather
taxing on your battery and system resources. But for a whiz-bang Android
showcase program, Stick it! is hard to beat.

Now that we have all the visual customization tools and applications that we
need to have Android’s home screen look and behave the way we want, let’s
apply these ideas to re-create two home screens. One will emulate a competing

15. https://play.google.com/store/apps/details?id=com.inisoft.mediaplayer.a
16. https://play.google.com/store/apps/details?id=com.myboyfriendisageek.airbrowser
17. https://play.google.com/store/apps/details?id=com.myboyfriendisageek.stickit

V413HAV report erratum • discuss


Chapter 2. Personalizing Your Home Screen • 22

phone operating system, and another will re-create the look and feel of a
popular desktop operating system.

2.4 Home Screen Customization


Part of the fun of having the level of customization that Android allows is to
re-create familiar computing metaphors. We’re going to do just that with a
quick walk-through of applying themes, widgets, and floaters to emulate the
look and feel of an alternative mobile OS platform. The other will be the re-
creation of a prevalent desktop operating system. Let’s begin by emulating
Microsoft Windows Phone.

Emulating the Windows Phone Look


Our first emulated home screen will be that of a Microsoft Windows Phone.
Like many themes available for free download from Google Play, the GO
Launcher EX Windows Phone 7 pays homage to the clean interface that the
Windows Phone user interface offers.18 While this theme doesn’t completely
redefine your Android’s phone behavior to emulate a Windows Phone, it does
provide a way to dress up the background and icons to give the appearance
of a Windows Phone–inspired home screen.

If you’re using the GO Launcher EX as your launcher of choice, installing


this theme is a breeze. Simply download it from Google Play and select it from
the list of themes in the Go Launcher preferences screen. On the other hand,
if, like me, you’ve opted to use TeslaCoil’s Nova Launcher Prime as your pre-
ferred Android launcher replacement, there are a few more steps you need to
take to incorporate the graphical elements contained in this Windows Phone
theme.

Configuring Nova Launcher Prime


After the theme has been downloaded, open Nova Launcher Prime’s settings.
Before you replace anything or alter your existing launcher settings, make a
backup of your existing Nova Launcher Prime configuration by selecting the
Backup and Import option. This will display the Backup and Import screen,
as shown in Figure 10, Nova Launcher Prime's Backup and Import screen, on
page 23.
Select the Backup label and name your backup or accept the default name of a
date stamp for your backup file. Now if something unexpected should happen
during the import of a new theme or you don’t like the way the new theme looks,
you can easily restore your current launcher layout and behavior.

18. https://play.google.com/store/apps/details?id=com.gau.go.launcherex.theme.wpsevenstyle

V413HAV report erratum • discuss


Home Screen Customization • 23

With a backup made, select the Import label from the Backup and Import
screen. Nova Launcher Prime will remind you that your existing launcher
settings will be replaced by the theme being imported. You know, the one you
were supposed to make a backup of, right? Since you do have a backup of
your current configuration, return to the Nova Settings screen and select the
Look and Feel option. From there, choose the Icon Theme option. The list of
the various themes installed on your Android device will be displayed, as
shown in Figure 11, A selection of installed icon themes.

Figure 10—Nova Launcher Prime’s Figure 11—A selection of


Backup and Import screen installed icon themes

Now we’re going to use Nova Launcher Prime’s ability to import icons from
other launcher application themes. In this case, we will borrow some Windows
Phone–like icons from a Windows 7 GO Launcher theme. Choose the GO
Launcher EX Windows Phone 7 theme from the list. This will replace icons
for standard Android programs such as Browser, Email, and Settings with a
Windows Phone icon lookalike. Arrange your choice of applications on your
home screen accordingly. Press and hold on the home-screen background to
either change it to a solid color or incorporate a matching Android wallpaper.
I prefer the live wallpaper that is installed with the Moon Phase Pro program.

V413HAV report erratum • discuss


Chapter 2. Personalizing Your Home Screen • 24

Tinker with the layout until you achieve the look and feel you’re comfortable
with. When you’re done, it may look similar to the one shown in Figure 12,
A Windows Phone theme.

In the next example, we will use a free theme


originally designed for ADW.Launcher and
pull in its icon assets to reflect a popular
desktop OS.

Emulating the OS X Desktop


For this next theme, you can either use the
launcher it was initially designed for
(ADW.Launcher) or use the icon import capa-
bility of Nova Launcher Prime, as we did in
the previous example. And as before, it’s
always a good idea to make a backup of your
existing settings in case something goes wrong
or you want to return to your original
launcher settings.

Install the ADW Theme MacOS Theme from


Google Play.19 Then, just as we did for the
Windows Phone theme, go into Nova Launcher
Prime’s settings screen. Select the “Look and
feel” option followed by the Icon Theme option. Figure 12—A Windows Phone
This will display a list of compatible themes theme
that Nova Launcher Prime can use. Select the
ADW MacOS theme from the list. Doing so will replace some of the standard
Android program icons with facsimiles of popular Mac OS X icons.

Next, replace the home screen’s background wallpaper with a Mac desktop
wallpaper. Launch the default Android or Google Chrome browser, search
Google Images for “Mac desktop wallpaper,”20 and select any of the ones that
appeal to you. Set the image to your wallpaper by long-pressing the image of
choice. A pop-up menu will appear, as shown in Figure 13, Setting background
wallpaper using an image from the Web, on page 25.

Select the “Set as wallpaper” option. This will download the selected image,
save it locally to your Android file storage, and set the image as the default
home-screen background.

19. https://play.google.com/store/apps/details?id=akglo.themes.macos
20. https://images.google.com

V413HAV

V413HAV report erratum • discuss


Next Steps • 25

With the background wallpaper set, create


shortcuts to popular Android programs such
as Browser, Email, and Settings on the home
screen. Complete the effect by running a
floater application like Stick it! to give the
home screen the look and feel of a mini OS X
desktop computer, as shown in Figure 14, Re-
creation of the OS X desktop, on page 26.

Making Your Own Home Screen


Now that you have an idea how to apply
existing themes to re-create familiar desktop
platforms, try making your own themes using
a similar approach. Go retro and re-create a
Commodore Amiga or Atari ST desktop on
your Android. How about blending several
desktop metaphors into your own unique
creation? Depending on how artistic you are,
you can even create your own background
and icon images based on a favorite interest Figure 13—Setting background
or hobby. Android allows you to explore and wallpaper using an image from the
apply your ideas at your leisure. Web

2.5 Next Steps


This chapter showed just how easy it is to customize the Android graphical
user experience to your liking. Whether it’s embracing the mobile lifestyle to
the fullest or harkening back to a legacy PC user experience, Android gives
you the freedom to choose how you want the interface to look and behave.
This is a significant advantage, especially compared to platforms like those
powered by Apple iOS. Android allows you to express yourself without jail-
breaking or rooting your device, something that might be required to do to
achieve the same effect on other mobile platforms.

Now that you have the knowledge and the tools to customize your Android
device the way you see fit, explore the numerous themes available for down-
load. If you’re using TeslaCoil’s Nova Launcher Prime, you will find that most
background and icon themes are compatible. However, most graphical
embellishment behaviors that accompany these themes, especially those
written for Go Launcher, don’t work as expected, if at all. Still, there are
hundreds of freely available themes to choose from, and that number is
expanding every day. If you don’t find one you like, you can create your own

V413HAV report erratum • discuss


Chapter 2. Personalizing Your Home Screen • 26

Figure 14—Re-creation of the OS X desktop

by converting pictures you took with your Android’s camera into home-screen
backgrounds and icons. Your first attempts might not be works of art, but
they will most definitely express what you want your mobile computing
experience to look like!

In the next chapter, we will explore how to customize the other side of the
user experience by focusing on audio. Specifically, we will learn how to
leverage audio in Android to augment and in some cases even replace the
Android user interface. Get ready to listen up!

V413HAV report erratum • discuss


CHAPTER 3

Listening to Your Android


Customizing your home screen’s look and behavior is visually stimulating,
but there are so many other facets of Android that allow it to be personalized.
In this chapter, we’ll take a look at interacting with the information that your
Android device can deliver.

For example, did you know that your Android can speak to you? Ever since
the Android 1.6 OS release, Android has had built-in text-to-speech (TTS)
functionality that could convert text into spoken words. However, it wasn’t
until the release of Android 4.2 that this TTS technology was actually tolerable
to listen to for long stretches. Earlier releases were robotic and lifeless. The
4.2 release includes a far more natural and less obnoxious voice. And if this
default voice isn’t to your liking, third-party text-to-speech synthesis products
like those from SVOX offer a selection of more than forty voices in multiple
languages.1 Before 4.2 came along, I used SVOX for my TTS needs.

But before we get to hear our phone, we should optimize our listening envi-
ronment for on-the-go audio data consumption.

3.1 Wearable Computing


With all the recent interest in wearable computing, people often forget that
an Android phone already is a wearable computer. I have been using my
Android phone as a wearable computing device for years. Let me explain.

The term wearable computer has a broad definition applying to everything


from a wristwatch to a powered laptop strapped to a backpack. In terms of
my Android phone, I wear it in a case attached to my belt loop. However,
rather than reaching for the phone every time I hear its message chime, I
have written scripts and applications that inform me of those messages

1. https://play.google.com/store/apps/details?id=com.svox.classic

V413HAV report erratum • discuss


Chapter 3. Listening to Your Android • 28

without ever having to remove the phone from its case. Email, text messages,
meeting notifications, countdown timers, motivational reminders, and other
information are controlled and delivered via my audio headset.

This chapter will show you how to put the pieces into place to allow you to
do the same thing. The setup is simple and inexpensive. And unlike Google’s
much hyped and considerably more expensive Glass project, my Android
wearable configuration doesn’t obstruct or distract my vision in any way.

Many people prefer to put their smartphones in their pocket, but I find it far
easier to use a wired headset when the device is holstered in a case strapped
to my belt. I prefer the Case Logic TBC-412 model. Even though this product
is officially designated as a video camera case, I find that it snuggly fits my
Galaxy Nexus even with the added thickness of a 3850mAh extra-capacity
battery. It also protects the phone from the elements, whether that is a drizzle
of rain or a dusty biking trail. The price is also cheaper than custom-designed
slip cases made specifically for the phone.

With the phone safely enclosed, run a headphone wire from your shoulders
to the phone. You can run the wire between layers of clothing to keep it out
of the way. Some headsets come with a helpful plastic clip that allows you to
put some slack into the wire. That keeps the earphones from tugging at your
ears. I attach this clip to my shirt collar to keep the left and right earphone
wires from slipping as I walk. The headphones I use on a daily basis are a
cheap single-button design with a built-in mic that is compatible with most
Samsung Galaxy phone models. These can often be found on Amazon for as
low as a dollar plus shipping. Note that the headset you use must have a
headset button, since you will use that button to answer calls, start and stop
audio, and run applications.

You can opt for a more expensive headset or earphones tailored to your phone
hardware. You can also choose to go entirely wireless via a Bluetooth headset.
But I have found from years of using my wearable configuration that these
choices produce annoyances. For expensive wired headsets, I find that the
wire at the stem of the headphone jack becomes weak over time and eventu-
ally loses either the left or right ear connection. I have even tried shielding
the wire from this wear and tear by looping the wire at the stem of the head-
phone jack and tightly wrapping it with electrical tape to no avail.

As for Bluetooth headsets, I find that the sound quality still hasn’t quite
matched the frequency ranges offered by wired headsets. There is also the
hassle of having to recharge the Bluetooth headset’s battery before use. And

V413HAV report erratum • discuss


The Sound of Data • 29

it can be a pain when that charge dies midway through the day without
having the means to recharge it until you’re home.

If you choose a wired approach, you need to manage the path of the wires
from your ears to your encased Android. Depending on the type of activity,
you can try running the wire in between your outer and undershirts, either
in front or back of you. Gadget-friendly clothing from progressive fashion
designers like ScottEVest includes shirts and jackets with dedicated enclosures
to run headphone wiring through so as not to flop around and get in your
way.2

After spending a wad of cash on replacing expensive earphones and wireless


headsets, I have reverted to cheap, throwaway headsets. They sound fine and
offer nearly the same level of durability as more expensive alternatives yet at
a far lower replacement cost.

With the headphones in place and the headphone button in a location that
is easy access, you can use this button to control the basic features of the
phone. Answer an incoming phone call as well as pause and play music with
a single short press of the center headphone button. The basic button press
behaviors are more or less universal across all Android phones that support
headset controls.

With your Android by your side and your audio headset on, let’s next turn
our focus to the software involved in voice recognition and spoken text inter-
action.

3.2 The Sound of Data


Before we can have Android speak to us, we first need to give it a voice. Setting
up TTS on Android 4.2 and newer is easy. Select the “Language & input”
option in the Settings program, then scroll down and select the “Text-to-speech
output” item. This will display the text-to-speech output settings shown in
Figure 15, Text-to-speech output settings, on page 30.

The default preferred speech engine in Android 4.2 is Google’s own TTS
technology. If you have SVOX or another third-party engine installed, it will
also be listed on this settings page. From this screen, you can also modify
the rate of speech playback, ranging from very slow to very fast. I prefer the
default normal speed, but try each setting to see which of the five playback
speeds works best for you. Select the “Listen to an example” option to hear

2. http://www.scottevest.com

V413HAV report erratum • discuss


Chapter 3. Listening to Your Android • 30

Android speak at the playback speed you chose. And now that we know
Android can talk, let’s explore how we can talk back to Android.

Running Android 4.2 and newer, you can hold


down the earphone button for about a second,
and the Google Now service will pop up,3 ready
to submit your query to Google for processing.
In addition to submitting who, when, what,
where, why, and how questions to Google’s
search engine, you can also command certain
aspects of the phone by voicing key phrases,
such as the following:

• “Call <contact>” will locate the contact


name most closely matching your spoken
entry and place a phone call to that con-
tact.

• “Listen to <track>” will play back the


requested music track using the default
music player.

• “Go to <URL>” will open a web browser


and display the requested URL.
Figure 15—Text-to-speech output
• “Open app <app name>” will launch the
settings
application, assuming it is installed on
your device.

• “What time is it?” will display the time.

• “Set an alarm for <time>” will set an alarm to sound at the requested
time.

• “Remind me to <task> at <time>” will convert your speech to text and add
the converted statement to your default calendar at the designated time
on the current day.

• “Navigate to <destination>” will map a route from your current location


to your stated destination.

So, that’s pretty cool, but Google Now has two notable drawbacks. First, while
Google’s voice recognition and speech-to-text translation services are amazing,

3. http://www.google.com/landing/now/

V413HAV report erratum • discuss


The Sound of Data • 31

they’re far from perfect. Try any of these phrases on a noisy bus or outside
on a windy day, and you’re not likely to see the results you expected.

Second, Google Now requires an Internet connection to work. That’s right. If


you want to play a song that is already stored on your device, ask to open an
application, or play a music track, Google Now has to submit your converted
speech-to-text request to its web service for these things to happen.

You would think that’s because Google needs its server farm to chew through
your speech input, convert it to a text string, and figure out the meaning of
the submitted phrase. But that doesn’t explain why Google offers offline
speech-to-text translation in Android 4.2 and newer. Until Google creates an
API that allows developers to access this offline speech-to-text translation
service, developers need to continue submitting spoken phrases over the
Internet to Google’s servers.

The takeaway from all this is that if you live and commute in a well-connected
city where wireless Internet connectivity is trustworthy, fast, and ubiquitous
and you’re not concerned about the voiceprint data Google is collecting from
your audible queries, then Google Now can be mighty helpful at times. But
while Google Now does a good job of translating responses such as the time
and reminders into audio, most answers require looking at the screen to
review the replies.

When I’m on the go, whether walking crowded city streets to work or riding
my recumbent along winding bike trails, I really don’t want to pull my phone
out of my pocket to see who sent me a text message and what they said, view
any upcoming events on my calendar, or simply check the time.

Fortunately, several hardworking Android developers have created applications


that address these needs. Let’s take a closer look at some of my favorites.

Talking SMS and Caller ID


Talking SMS and Caller ID offer hands-free text-to-speech announcements
of inbound text messages and calls.4 Knowing that you won’t miss an impor-
tant message or wonder whether the call you’re receiving is from someone
worth stopping to talk to is a nice anxiety dissipater. When you accept the
application’s permissions, it has complete access to your contacts list. If an
inbound caller’s phone number isn’t associated with an existing contact, the
program will read the phone number instead. If an SMS is received from an
unknown contact, it won’t bother reading the message (kind of nice when

4. https://play.google.com/store/apps/details?id=mahmed.net.spokencallername

V413HAV report erratum • discuss


Discovering Diverse Content Through
Random Scribd Documents
date of the 27th, accordingly, I find it duly entered that “the vagabond
who came in for water must have had a confederate, who got into
the hall whilst we were attending to his comrade, for yesterday there
was a great lamentation over cloaks and great-coats missing from
the hall, and as the day wore on the area of plunder was extended.
Carl discovers he has been robbed of his best clothes, and Caroline
has lost her watch and many petticoats.”
Thanksgiving Day on the 28th was celebrated by enormous
drunkenness in the army. The weather varied between days of
delicious summer—soft, bright, balmy, and beautiful beyond
expression—and days of wintry storm, with torrents of rain.
Some excitement was caused at the end of the month by the
report I had received information from England that the law officers
of the Crown had given it as their opinion that a United States man-
of-war would be justified by Lord Stowell’s decisions in taking Mason
and Slidell even in the British Channel, if the Nashville transferred
them to a British mail steamer. This opinion was called for in
consequence of the Tuscarora appearing in Southampton Water;
and, having heard of it, I repeated it in strict confidence to some one
else, till at last Baron de Stoeckl came to ask me if it was true.
Receiving passengers from the Nashville, however, would have been
an act of direct intercourse with an enemy’s ship. In the case of the
Trent the persons seized had come on board as lawful passengers
at a neutral port.
The tide of success runs strongly in favour of the North at present,
although they generally get the worst of it in the small affairs in the
front of Washington. The entrance to Savannah has been occupied,
and by degrees the fleets are biting into the Confederate lines along
the coast, and establishing positions which will afford bases of
operations to the Federals hereafter. The President and Cabinet
seem in better spirits, and the former indulges in quaint speculations,
which he transfers even to State papers. He calculates, for instance,
there are human beings now alive who may ere they die behold the
United States peopled by 250 millions of souls. Talking of a high
mound on the prairie, in Illinois, he remarked, “that if all the nations
of the earth were assembled there, a man standing on its top would
see them all, for that the whole human race would fit on a space
twelve miles square, which was about the extent of the plain.”
CHAPTER XXIII.

A Captain under arrest—Opening of Congress—Colonel Dutassy—An ex-


pugilist turned Senator—Mr. Cameron—Ball in the officers’ huts—
Presentation of standards at Arlington—Dinner at Lord Lyons’—Paper
currency—A polyglot dinner—Visit to Washington’s Tomb—Mr. Chase’s
Report—Colonel Seaton—Unanimity of the South—The Potomac
blockade—A Dutch-American Crimean acquaintance—The American
Lawyers on the Trent affair—Mr. Sumner—M‘Clellan’s Army—
Impressions produced in America by the English Press on the affair of
the Trent—Mr. Sumner on the crisis—Mutual feelings of the two nations
—Rumours of war with Great Britain.

December 1st.—A mixed party of American officers and English


went to-day to the post at Great Falls, about sixteen or seventeen
miles up the Potomac, and were well repaid by the charming
scenery, and by a visit to an American military station in a state of
nature. The captain in command told us over a drink that he was
under arrest, because he had refused to do duty as lieutenant of the
guard, he being a captain. “But I have written to M‘Clellan about it,”
said he, “and I’m d—d if I stay under arrest more than three days
longer.” He was not aware that the General’s brother, who is a
captain on his staff, was sitting beside him at the time. This worthy
centurion further informed us he had shot a man dead a short time
before for disobeying his orders. “That he did,” said his sympathising
and enthusiastic orderly, “and there’s the weapon that done it.” The
captain was a boot and shoe maker by trade, and had travelled
across the isthmus before the railway was made to get orders for his
boots. A hard, determined, fierce “sutor,” as near a savage as might
be.
“And what will you do, captain,” asked I, “if they keep you in
arrest?”
“Fight for it, sir. I’ll go straight away into Pennsylvania with my
company, and we’ll whip any two companies they can send to stop
us.”
Mr. Sumner paid me a visit on my return from our excursion, and
seems to think everything is in the best possible state.
December 2nd.—Congress opened to-day. The Senate did
nothing. In the House of Representatives some Buncombe
resolutions were passed about Captain Wilkes, who has become a
hero—“a great interpreter of international law,” and also
recommending that Messrs. Mason and Slidell be confined in felons’
cells, in retaliation for Colonel Corcoran’s treatment by the
Confederates. M. Blondel, the Belgian minister, who was at the court
of Greece during the Russian war, told me that when the French and
English fleets lay in the Piræus, a United States vessel, commanded,
he thinks, by Captain Stringham, publicly received M. Persani, the
Russian ambassador, on board, hoisted and saluted the Russian flag
in the harbour, whereupon the French Admiral, Barbier de Tinan,
proposed to the English Admiral to go on board the United States
vessel and seize the ambassador, which the British officer refused to
do.
December 3rd.—Drove down to the Capitol, and was introduced to
the floor of the Senate by Senator Wilson, and arrived just as Mr.
Forney commenced reading the President’s message, which was
listened to with considerable interest. At dinner, Colonel D’Utassy, of
the Garibaldi legion, who gives a curious account of his career. A
Hungarian by birth, he went over from the Austrian service, and
served under Bem; was wounded and taken prisoner at Temesvar,
and escaped from Spielberg, through the kindness of Count
Bennigsen, making his way to Semlin, in the disguise of a servant,
where Mr. Fonblanque, the British consul, protected him. Thence he
went to Kossuth at Shumla, finally proceeded to Constantinople,
where he was engaged to instruct the Turkish cavalry; turned up in
the Ionian Islands, where he was engaged by the late Sir H. Ward,
as a sort of secretary and interpreter, in which capacity he also
served Sir G. Le Marchant. In the United States he was earning his
livelihood as a fencing, dancing, and language master; and when the
war broke out he exerted himself to raise a regiment, and succeeded
in completing his number in seventeen days, being all the time
obliged to support himself by his lessons. I tell his tale as he told it to
me.
One of our friends, of a sporting turn, dropped in to-night, followed
by a gentleman dressed in immaculate black, and of staid
deportment, whose name I did not exactly catch, but fancied it was
that of a senator of some reputation. As the stranger sat next me,
and was rubbing his knees nervously, I thought I would commence
conversation.
“It appears, sir, that affairs in the south-west are not so promising.
May I ask you what is your opinion of the present prospects of the
Federals in Missouri?”
I was somewhat disconcerted by his reply, for rubbing his knees
harder than ever, and imprecating his organs of vision in a very
sanguinary manner, he said—
“Well, d—— if I know what to think of them. They’re a b—— rum
lot, and they’re going on in a d—— rum way. That’s what I think.”
The supposed legislator, in fact, was distinguished in another
arena, and was no other than a celebrated pugilist, who served his
apprenticeship in the English ring, and has since graduated in
honours in America.
I dined with Mr. Cameron, Secretary of War, where I met Mr.
Forney, Secretary of the Senate; Mr. House, Mr. Wilkeson, and
others, and was exceedingly interested by the shrewd conversation
and candid manner of our host. He told me he once worked as a
printer in the city of Washington, at ten dollars a week, and twenty
cents an hour for extra work at the case on Sundays. Since that time
he has worked onwards and upwards, and amassed a large fortune
by contracts for railways and similar great undertakings. He says the
press rules America, and that no one can face it and live; which is
about the worst account of the chances of an honest longevity I can
well conceive. His memory is exact, and his anecdotes, albeit he has
never seen any but Americans, or stirred out of the States, very
agreeable. Once there lived at Washington a publican’s daughter,
named Mary O’Neil, beautiful, bold, and witty. She captivated a
member of Congress, who failed to make her less than his wife; and
by degrees Mrs. Eaton—who may now be seen in the streets of
Washington, an old woman, still bright-eyed and, alas! bright-
cheeked, retaining traces of her great beauty—became a leading
personage in the State, and ruled the imperious, rugged, old Andrew
Jackson so completely, that he broke up his Cabinet and dismissed
his ministers on her account. In the days of her power she had done
some trifling service to Mr. Cameron, and he has just repaired it by
conferring some military appointment on her grandchild.
The dinner, which was preceded by deputations, was finished by
one which came from the Far West, and was introduced by Mr.
Hannibal Hamlin, the Vice-President; Mr. Owen Lovejoy, Mr.
Bingham, and other ultra-Abolitionist members of Congress; and
then speeches were made, and healths were drunk, and toasts were
pledged, till it was time for me to drive to a ball given by the officers
of the 5th United States Cavalry, which was exceedingly pretty, and
admirably arranged in wooden huts, specially erected and decorated
for the occasion. A huge bonfire in the centre of the camp,
surrounded by soldiers, by the carriage drivers, and by negro
servants, afforded the most striking play of colour and variety of light
and shade I ever beheld.
December 4th.—To Arlington, where Senator Ira Harris presented
flags—that is, standards—to a cavalry regiment called after his
name; the President, Mrs. Lincoln, ministers, generals, and a large
gathering present. Mr. Harris made a very long and a very fierce
speech; it could not be said Ira furor brevis est; and Colonel Davies,
in taking the standard, was earnest and lengthy in reply. Then a
barrister presented colour No. 2 in a speech full of poetical
quotations, to which Major Kilpatrick made an excellent answer.
Though it was strange enough to hear a political disquisition on the
causes of the rebellion from a soldier in full uniform, the proceedings
were highly theatrical and very effective. “Take, then, this flag,” &c.
—“Defend it with your,” &c.—“Yes, sir, we will guard this sacred
emblem with—,” &c. The regiment then went through some
evolutions, which were brought to an untimely end by a feu de joie
from the infantry in the rear, which instantly broke up the squadrons,
and sent them kicking, plunging, and falling over the field, to the
great amusement of the crowd.
Dined with Lord Lyons, where was Mr. Galt, Financial Minister of
Canada; Mr. Stewart, who has arrived to replace Mr. Irvine, and
others. In our rooms, a grand financial discussion took place in
honour of Mr. Galt, between Mr. Butler Duncan and others, the
former maintaining that a general issue of national paper was
inevitable. A very clever American maintained that the North will be
split into two great parties by the result of the victory which they are
certain to gain over the South—that the Democrats will offer the
South concessions more liberal than they could ever dream of, and
that both will unite against the Abolitionists and Black Republicans.
December 6th.—Mr. Riggs says the paper currency scheme will
produce money, and make every man richer. He is a banker, and
ought to know; but to my ignorant eye it seems likely to prove most
destructive, and I confess, that whatever be the result of this war, I
have no desire for the ruin of so many happy communities as have
sprung up in the United States. Had it been possible for human
beings to employ popular institutions without intrigue and miserable
self-seeking, and to be superior to faction and party passion, the
condition of parts of the United States must cause regret that an
exemption from the usual laws which regulate human nature was not
made in America; but the strength of the United States—directed by
violent passions, by party interest, and by selfish intrigues—was
becoming dangerous to the peace of other nations, and therefore
there is an utter want of sympathy with them in their time of trouble.
I dined with Mr. Galt, at Willard’s, where we had a very pleasant
party, in spite of financial dangers.
December 7th.—A visit to the Garibaldi Guard with some of the
Englishry, and an excellent dinner at the mess, which presented a
curious scene, and was graced by sketches from a wonderful
polyglot chaplain. What a company!—the officers present were
composed as follows:—Five Spaniards, six Poles and Hungarians,
two Frenchmen—the most soldierly-looking men at table—one
American, four Italians, and nine Teutons of various States in
Germany.
December 8th.—A certain excellent Colonel who commands a
French regiment visited us to-day. When he came to Washington,
one of the Foreign Ministers who had been well acquainted with him
said, “My dear Colonel, what a pity we can be no longer friends.”
“Why so, Baron?” “Ah, we can never dine together again.” “Why not?
Do you forbid me your table?” “No, Colonel, but how can I invite a
man who can command the services of at least 200 cooks in his own
regiment?” “Well then, Baron, you can come and dine with me.”
“What! how do you think I could show myself in your camp—how
could I get my hair dressed to sit at the table of a man who
commands 300 coiffeurs?” I rode out to overtake a party who had
started in carriages for Mount Vernon to visit Washington’s tomb, but
missed them in the wonderfully wooded country which borders the
Potomac, and returned alone.
December 9th.—Spent the day over Mr. Chase’s report, a copy of
which he was good enough to send me with a kind note, and went
out in the evening with my head in a state of wild financial confusion,
and a general impression that the financial system of England is very
unsound.
December 10th.—Paid a visit to Colonel Seaton, of the National
Intelligencer, a man deservedly respected and esteemed for his
private character, which has given its impress to the journal he has
so long conducted. The New York papers ridicule the Washington
organ, because it does not spread false reports daily in the form of
telegraphic “sensation” news, and indeed one may be pretty sure
that a fact is a fact when it is found in the Intelligencer; but the man,
nevertheless, who is content with the information he gets from it, will
have no reason to regret, in the accuracy of his knowledge or the
soundness of his views, that he has not gone to its noisy and
mendacious rivals. In the minds of all the very old men in the States,
there is a feeling of great sadness and despondency respecting the
present troubles, and though they cling to the idea of a restoration of
the glorious Union of their youth, it is hoping against hope. “Our
game is played out. It was the most wonderful and magnificent
career of success the world ever saw, but rogues and gamblers took
up the cards at last; they quarrelled, and are found out.”
In the evening, supped at Mr. Forney’s, where there was a very
large gathering of gentlemen connected with the press; Mr.
Cameron, Secretary of War; Colonel Mulligan, a tall young man, with
dark hair falling on his shoulders, round a Celtic impulsive face, and
a hazy enthusiastic-looking eye; and other celebrities. Terrapin soup
and canvas-backs, speeches, orations, music, and song, carried the
company onwards among the small hours.
December 11th.—The unanimity of the people in the South is
forced on the conviction of the statesmen and people of the North,
by the very success of their expeditions in Secession. They find the
planters at Beaufort and elsewhere burning their cotton and crops,
villages and towns deserted at their approach, hatred in every eye,
and curses on women’s tongues. They meet this by a corresponding
change in their own programme. The war which was made to
develop and maintain Union sentiment in the South, and to enable
the people to rise against a desperate faction which had enthralled
them, is now to be made a crusade against slaveholders, and a war
of subjugation—if need be, of extermination—against the whole of
the Southern States. The Democrats will, of course, resist this
barbarous and hopeless policy. There is a deputation of Irish
Democrats here now, to effect a general exchange of prisoners,
which is an operation calculated to give a legitimate character to the
war, and is pro tanto a recognition of the Confederacy as a
belligerent power.
December 12th.—The navy are writhing under the disgrace of the
Potomac blockade, and deny it exists. The price of articles in
Washington which used to come by the river affords disagreeable
proof to the contrary. And yet there is not a true Yankee in
Pennsylvania Avenue who does not believe, what he reads every
day, that his glorious navy could sweep the fleets of France and
England off the seas to-morrow, though the Potomac be closed, and
the Confederate batteries throw their shot and shell into the Federal
camps on the other side. I dined with General Butterfield, whose
camp is pitched in Virginia, on a knoll and ridge from which a
splendid view can be had over the wooded vales and hills extending
from Alexandria towards Manassas, whitened with Federal tents and
huts. General Fitz-John Porter and General M‘Dowell were among
the officers present.
December 12th.—A big-bearded, spectacled, moustachioed,
spurred, and booted officer threw himself on my bed this morning ere
I was awake. “Russell, my dear friend, here you are at last; what
ages have passed since we met!” I sat up and gazed at my friend.
“Bohlen! don’t you remember Bohlen, and our rides in Turkey, our
visit to Shumla and Pravady, and all the rest of it?” Of course I did. I
remembered an enthusiastic soldier, with a fine guttural voice, and a
splendid war saddle and saddle-cloth, and brass stirrups and
holsters, worked with eagles all over, and a uniform coat and cap
with more eagles flying amidst laurel leaves and U.S.’s in gold, who
came out to see the fighting in the East, and made up his mind that
there would be none, when he arrived at Varna, and so started off
incontinent up the Danube, and returned to the Crimea when it was
too late; and a very good, kindly, warm-hearted fellow was the
Dutch-American, who—once more in his war paint, this time acting
Brigadier-General[9]—renewed the memories of some pleasant days
far away; and our talk was of cavasses and khans, and tchibouques,
and pashas, till his time was up to return to his fighting Germans of
Blenker’s division.
He was not the good-natured officer who said the other day, “The
next day you come down, sir, if my regiment happens to be on picket
duty, we’ll have a little skirmish with the enemy, just to show you how
our fellows are improved.” “Perhaps you might bring on a general
action, Colonel.” “Well, sir, we’re not afraid of that, either! Let ’em
come on.” It did so happen that some young friends of mine, of
H.M.’s 30th, who had come down from Canada to see the army
here, went out a day or two ago with an officer on General Smith’s
staff, formerly in our army, who yet suffers from a wound received at
the Alma, to have a look at the enemy with a detachment of men.
The enemy came to have a look at them, whereby it happened that
shots were exchanged, and the bold Britons had to ride back as hard
as they could, for their men skedaddled, and the Secession cavalry
slipping after them, had a very pretty chase for some miles; so the
30th men saw more than they bargained for.
Dined at Baron Gerolt’s, where I had the pleasure of meeting
Judge Daly, who is perfectly satisfied the English lawyers have not a
leg to stand upon in the Trent case. On the faith of old and very
doubtful, and some purely supposititious, cases, the American
lawyers have made up their minds that the seizure of the “rebel”
ambassadors was perfectly legitimate and normal. The Judge
expressed his belief that if there was a rebellion in Ireland, and that
Messrs. Smith O’Brien and O’Gorman ran the blockade to France,
and were going on their passage from Havre to New York in a United
States steamer, they would be seized by the first British vessel that
knew the fact. “Granted; and what would the United States do?” “I
am afraid we should be obliged to demand that they be given up;
and if you were strong enough at the time, I dare say you would fight
sooner than do so.” Mr. Sumner, with whom I had some conversation
this afternoon, affects to consider the question eminently suitable for
reference and arbitration.
In spite of drills and parades, M‘Clellan has not got an army yet. A
good officer, who served as brigade-major in our service, told me the
men were little short of mutinous, with all their fine talk, though they
could fight well. Sometimes they refuse to mount guard, or to go on
duty not to their tastes; officers refuse to serve under others to whom
they have a dislike; men offer similar personal objections to officers.
M‘Clellan is enforcing discipline, and really intends to execute a most
villainous deserter this time.
December 15th.—The first echo of the San Jacinto’s guns in
England reverberated to the United States, and produced a profound
sensation. The people had made up their minds John Bull would
acquiesce in the seizure, and not say a word about it; or they
affected to think so; and the cry of anger which has resounded
through the land, and the unmistakable tone of the British press, at
once surprise, and irritate, and disappoint them. The American
journals, nevertheless, pretend to think it is a mere vulgar
excitement, and that the press is “only indulging in its habitual
bluster.”
December 16th.—I met Mr. Seward at a ball and cotillion party,
given by M. de Lisboa; and as he was in very good humour, and was
inclined to talk, he pointed out to the Prince of Joinville, and all who
were inclined to listen, and myself, how terrible the effects of a war
would be if Great Britain forced it on the United States. “We will wrap
the whole world in flames!” he exclaimed. “No power so remote that
she will not feel the fire of our battle and be burned by our
conflagration.” It is inferred that Mr. Seward means to show fight.
One of the guests, however, said to me, “That’s all bugaboo talk.
When Seward talks that way, he means to break down. He is most
dangerous and obstinate when he pretends to agree a good deal
with you.” The young French Princes, and the young and pretty
Brazilian and American ladies, danced and were happy,
notwithstanding the storms without.
Next day I dined at Mr. Seward’s, as the Minister had given carte
blanche to a very lively and agreeable lady, who has to lament over
an absent husband in this terrible war, to ask two gentlemen to dine
with him, and she had been pleased to select myself and M. de
Geoffroy, Secretary of the Trench Legation, as her thick and her thin
umbræ; and the company went off in the evening to the White
House, where there was a reception, whereat I imagined I might be
de trop, and so home.
Mr. Seward was in the best spirits, and told one or two rather long,
but very pleasant, stories. Now it is evident he must by this time
know Great Britain has resolved on the course to be pursued, and
his good humour, contrasted with the irritation he displayed in May
and June, is not intelligible.
The Russian Minister, at whose house I dined next day, is better
able than any man to appreciate the use made of the Czar’s
professions of regret for the evils which distract the States by the
Americans; but it is the fashion to approve of everything that France
does, and to assume a violent affection for Russia. The Americans
are irritated by war preparations on the part of England, in case the
Government of Washington do not accede to their demands; and, at
the same time, much annoyed that all European nations join in an
outcry against the famous project of destroying the Southern
harbours by the means of the stone fleet.
December 20th.—I went down to the Senate, as it was expected
at the Legation and elsewhere the President would send a special
message to the Senate on the Trent affair; but, instead, there was
merely a long speech from a senator, to show the South did not like
democratic institutions. Lord Lyons called on Mr. Seward yesterday
to read Lord Russell’s dispatch to him, and to give time for a reply;
but Mr. Seward was out, and Mr. Sumner told me the Minister was
down with the Committee of Foreign Relations, where there is a
serious business in reference to the State of Mexico and certain
European Powers under discussion, when the British Minister went
to the State Department.
Next day Lord Lyons had two interviews with Mr. Seward, read the
despatch, which simply asks for surrender of Mason and Slidell and
reparation, without any specific act named, but he received no
indication from Mr. Seward of the course he would pursue. Mr.
Lincoln has “put down his foot” on no surrender. “Sir!” exclaimed the
President, to an old Treasury official the other day, “I would sooner
die than give them up.” “Mr. President,” was the reply, “your death
would be a great loss, but the destruction of the United States would
be a still more deplorable event.”
Mr. Seward will, however, control the situation, as the Cabinet will
very probably support his views; and Americans will comfort
themselves, in case the captives are surrendered, with a promise of
future revenge, and with the reflection that they have avoided a very
disagreeable intervention between their march of conquest and the
Southern Confederacy. The general belief of the diplomatists is, that
the prisoners will not be given up, and in that case Lord Lyons and
the Legation will retire from Washington for the time, probably to
Halifax, leaving Mr. Monson to wind up affairs and clear out the
archives. But it is understood that there is no ultimatum, and that
Lord Lyons is not to indicate any course of action, should Mr. Seward
inform him the United States Government refuses to comply with the
demands of Great Britain.
Any humiliation which may be attached to concession will be
caused by the language of the Americans themselves, who have
given in their press, in public meetings, in the Lower House, in the
Cabinet, and in the conduct of the President, a complete ratification
of the act of Captain Wilkes, not to speak of the opinions of the
lawyers, and the speeches of their orators, who declare “they will
face any alternative, but that they will never surrender.” The friendly
relations which existed between ourselves and many excellent
Americans are now rendered somewhat constrained by the prospect
of a great national difference.
December (Sunday) 22nd.—Lord Lyons saw Mr. Seward again,
but it does not appear that any answer can be expected before
Wednesday. All kinds of rumours circulate through the city, and are
repeated in an authoritative manner in the New York papers.
December 23rd.—There was a tremendous storm, which drove
over the city and shook the houses to the foundation. Constant
interviews took place between the President and members of the
Cabinet, and so certain are the people that war is inevitable, that an
officer connected with the executive of the Navy Department came in
to tell me General Scott was coming over from Europe to conduct
the Canadian campaign, as he had thoroughly studied the
geography of the country, and that in a very short time he would be
in possession of every strategic position on the frontier, and chaw up
our reinforcements. Late in the evening, Mr. Olmsted called to say he
had been credibly informed Lord Lyons had quarrelled violently with
Mr. Seward, had flown into a great passion with him, and so
departed. The idea of Lord Lyons being quarrelsome, passionate, or
violent, was preposterous enough to those who knew him; but the
American papers, by repeated statements of the sort, have
succeeded in persuading their public that the British Minister is a
plethoric, red-faced, large-stomached man in top-boots, knee-
breeches, yellow waistcoat, blue cut-away, brass buttons, and broad-
brimmed white hat, who is continually walking to the State
Department in company with a large bulldog, hurling defiance at Mr.
Seward at one moment, and the next rushing home to receive
despatches from Mr. Jefferson Davis, or to give secret instructions to
the British Consuls to run cargoes of quinine and gunpowder through
the Federal blockade. I was enabled to assure Mr. Olmsted there
was not the smallest foundation for the story; but he seemed
impressed with a sense of some great calamity, and told me there
was a general belief that England only wanted a pretext for a quarrel
with the United States; nor could I comfort him by the assurance that
there were good reasons for thinking General Scott would very soon
annex Canada, in case of war.
C H A P T E R X X I V.

News of the death of the Prince Consort—Mr. Sumner and the Trent Affair—
Dispatch to Lord Russell—The Southern Commissioners given up—
Effects on the friends of the South—My own unpopularity at New York—
Attack of fever—My tour in Canada—My return to New York in February
—Successes of the Western States—Mr. Stanton succeeds Mr. Cameron
as Secretary of War—Reverse and retreat of M‘Clellan—My free pass—
The Merrimac and Monitor—My arrangement to accompany M‘Clellan’s
head-quarters—Mr. Stanton refuses his sanction—National vanity
wounded by my truthfulness—My retirement and return to Europe.

December 24th.—-This evening came in a telegram from Europe


with news which cast the deepest gloom over all our little English
circle. Prince Albert dead! At first no one believed it; then it was
remembered that private letters by the last mail had spoken
despondingly of his state of health, and that the “little cold” of which
we had heard was described in graver terms. Prince Alfred dead!
“Oh, it may be Prince Alfred,” said some; and sad as it would be for
the Queen and the public to lose the Sailor Prince, the loss could not
be so great as that which we all felt to be next to the greatest. The
preparations which we had made for a little festivity to welcome in
Christmas morning were chilled by the news, and the eve was not of
the joyous character which Englishmen delight to give it, for the
sorrow which fell on all hearts in England had spanned the Atlantic,
and bade us mourn in common with the country at home.
December 25th.—Lord Lyons, who had invited the English in
Washington to dinner, gave a small quiet entertainment, from which
he retired early.
December 26th.—No answer yet. There can be but one. Press
people, soldiers, sailors, ministers, senators, Congress men, people
in the street, the voices of the bar-room—all are agreed. “Give them
up? Never! We’ll die first!” Senator Sumner, M. De Beaumont, M. De
Geoffroy, of the French Legation, dined with me, in company with
General Van Vliet, Mr. Anderson, and Mr. Lamy, &c.; and in the
evening Major Anson, M.P., Mr. Johnson, Captain Irwin, U.S.A., Lt.
Wise, U.S.N., joined our party, and after much evasion of the
subject, the English despatch and Mr. Seward’s decision turned up
and caused some discussion. Mr. Sumner, who is Chairman of the
Committee on Foreign Relations of the Senate, and in that capacity
is in intimate rapport with the President, either is, or affects to be,
incredulous respecting the nature of Lord Russell’s despatch this
evening, and argues that, at the very utmost, the Trent affair can only
be a matter for mediation, and not for any peremptory demand, as
the law of nations has no exact precedent to bear upon the case,
and that there are so many instances in which Sir W. Scott’s (Lord
Stowell’s) decisions in principle appear to justify Captain Wilkes. All
along he has held this language, and has maintained that at the very
worst there is plenty of time for protocols, despatches, and
references, and more than once he has said to me, “I hope you will
keep the peace; help us to do so,”—the peace having been already
broken by Captain Wilkes and the Government.
December 27th.—This morning Mr. Seward sent in his reply to
Lord Russell’s despatch—“grandis et verbosa epistola.” The result
destroys my prophecies, for, after all, the Southern Commissioners
or Ambassadors are to be given up. Yesterday, indeed, in an under-
current of whispers among the desponding friends of the South,
there went a rumour that the Government had resolved to yield.
What a collapse! What a bitter mortification! I had scarcely finished
the perusal of an article in a Washington paper,—which, let it be
understood, is an organ of Mr. Lincoln,—stating that “Mason and
Slidell would not be surrendered, and assuring the people they need
entertain no apprehension of such a dishonourable concession,”
when I learned beyond all possibility of doubt, that Mr. Seward had
handed in his despatch, placing the Commissioners at the disposal
of the British Minister. A copy of the despatch will be published in the
National Intelligencer to-morrow morning at an early hour, in time to
go to Europe by the steamer which leaves New York.
After dinner, those who were in the secret were amused by
hearing the arguments which were started between one or two
Americans and some English in the company, in consequence of a
positive statement from a gentleman who came in, that Mason and
Slidell had been surrendered. I have resolved to go to Boston, being
satisfied that a great popular excitement and uprising will, in all
probability, take place on the discharge of the Commissioners from
Fort Warren. What will my friend, the general, say, who told me
yesterday “he would snap his sword, and throw the pieces into the
White House, if they were given up?”
December 28th.—The National Intelligencer of this morning
contains the despatches of Lord Russell, M. Thouvenel, and Mr.
Seward. The bubble has burst. The rage of the friends of
compromise, and of the South, who saw in a war with Great Britain
the complete success of the Confederacy, is deep and burning, if not
loud; but they all say they never expected anything better from the
cowardly and braggart statesmen who now rule in Washington.
Lord Lyons has evinced the most moderate and conciliatory spirit,
and has done everything in his power to break Mr. Seward’s fall on
the softest of eider down. Some time ago we were all prepared to
hear nothing less would be accepted than Captain Wilkes taking
Messrs. Mason and Slidell on board the San Jacinto, and
transferring them to the Trent, under a salute to the flag, near the
scene of the outrage; at all events, it was expected that a British
man-of-war would have steamed into Boston, and received the
prisoners under a salute from Fort Warren; but Mr. Seward,
apprehensive that some outrage would be offered by the populace to
the prisoners and the British Flag, has asked Lord Lyons that the
Southern Commissioners may be placed, as it were, surreptitiously,
in a United States boat, and carried to a small seaport in the State of
Maine, where they are to be placed on board a British vessel as
quietly as possible; and this exigent, imperious, tyrannical, insulting
British Minister has cheerfully acceded to the request. Mr. Conway
Seymour, the Queen’s messenger, who brought Lord Russell’s
despatch, was sent back with instructions for the British Admiral, to
send a vessel to Providence town for the purpose; and as Mr.
Johnson, who is nearly connected with Mr. Eustis, one of the
prisoners, proposed going to Boston to see his brother-in-law, if
possible, ere he started, and as there was not the smallest prospect
of any military movement taking place, I resolved to go northwards
with him; and we left Washington accordingly on the morning of the
31st of December, and arrived at the New York Hotel the same night.
To my great regret and surprise, however, I learned it would be
impracticable to get to Fort Warren and see the prisoners before
their surrender. My unpopularity, which had lost somewhat of its
intensity, was revived by the exasperation against everything
English, occasioned by the firmness of Great Britain in demanding
the Commissioners; and on New Year’s Night, as I heard
subsequently, Mr. Grinell and other members of the New York Club
were exposed to annoyance and insult, by some of their brother
members, in consequence of inviting me to be their guest at the club.
The illness which had prostrated some of the strongest men in
Washington, including General M‘Clellan himself, developed itself as
soon as I ceased to be sustained by the excitement, such as it was,
of daily events at the capital, and by expectations of a move; and for
some time an attack of typhoid fever confined me to my room, and
left me so weak that I was advised not to return to Washington till I
had tried change of air. I remained in New York till the end of
January, when I proceeded to make a tour in Canada, as it was quite
impossible for any operation to take place on the Potomac, where
deep mud, alternating with snow and frost, bound the contending
armies in winter quarters.
On my return to New York, at the end of February, the North was
cheered by some signal successes achieved in the West principally
by gunboats, operating on the lines of the great rivers. The greatest
results have been obtained in the capture of Fort Donaldson and
Fort Henry, by Commodore Foote’s flotilla co-operating with the land
forces. The possession of an absolute naval supremacy, of course,
gives the North United States powerful means of annoyance and
inflicting injury and destruction on the enemy; it also secures for
them the means of seizing upon bases of operations wherever they
please, of breaking up the enemy’s lines, and maintaining
communications; but the example of Great Britain in the
revolutionary war should prove to the United States that such
advantages do not, by any means, enable a belligerent to subjugate
a determined people resolved on resistance to the last. The long-
threatened encounter between Bragg and Browne has taken place at
Pensacola, without effect, and the attempts of the Federals to
advance from Port Royal have been successfully resisted. Sporadic
skirmishes have sprung up over every border State; but, on the
whole, success has inclined to the Federals in Kentucky and
Tennessee.
On the 1st March, I arrived in Washington once more, and found
things very much as I had left them: the army recovering the effect of
the winter’s sickness and losses, animated by the victories of their
comrades in Western fields, and by the hope that the ever-coming
to-morrow would see them in the field at last. In place of Mr.
Cameron, an Ohio lawyer named Stanton has been appointed
Secretary of War. He came to Washington, a few years ago, to
conduct some legal proceedings for Mr. Daniel Sickles, and by his
energy, activity, and a rapid conversion from democratic to
republican principles, as well as by his Union sentiments,
recommended himself to the President and his Cabinet.
The month of March passed over without any remarkable event in
the field. When the army started at last to attack the enemy—a
movement which was precipitated by hearing that they were moving
away—they went out only to find the Confederates had fallen back
by interior lines towards Richmond, and General M‘Clellan was
obliged to transport his army from Alexandria to the peninsula of York
Town, where his reverses, his sufferings, and his disastrous retreat,
are so well known and so recent, that I need only mention them as
among the most remarkable events which have yet occurred in this
war.
I had looked forward for many weary months to participating in the
movement and describing its results. Immediately on my arrival in
Washington, I was introduced to Mr. Stanton by Mr. Ashman,
formerly member of Congress and Secretary to Mr. Daniel Webster,
and the Secretary, without making any positive pledge, used words,

You might also like