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

Instant download Android for Absolute Beginners - Getting Started with Mobile Apps Development Using the Android Java SDK 1st Edition Grant Allen pdf all chapter

The document promotes the ebook 'Android for Absolute Beginners' by Grant Allen, which is designed to help new developers start with mobile app development using the Android Java SDK. It includes links to various related ebooks and resources available for immediate download on ebookmeta.com. The document also outlines the structure and content of the ebook, emphasizing its educational value for aspiring Android developers.

Uploaded by

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

Instant download Android for Absolute Beginners - Getting Started with Mobile Apps Development Using the Android Java SDK 1st Edition Grant Allen pdf all chapter

The document promotes the ebook 'Android for Absolute Beginners' by Grant Allen, which is designed to help new developers start with mobile app development using the Android Java SDK. It includes links to various related ebooks and resources available for immediate download on ebookmeta.com. The document also outlines the structure and content of the ebook, emphasizing its educational value for aspiring Android developers.

Uploaded by

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

Get the full ebook with Bonus Features for a Better Reading Experience on ebookmeta.

com

Android for Absolute Beginners - Getting Started


with Mobile Apps Development Using the Android
Java SDK 1st Edition Grant Allen

https://ebookmeta.com/product/android-for-absolute-
beginners-getting-started-with-mobile-apps-development-
using-the-android-java-sdk-1st-edition-grant-allen/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookmeta.com


Recommended digital products (PDF, EPUB, MOBI) that
you can download immediately if you are interested.

Beginning Android 5th Edition Get started building apps


for the Android platform Grant Allen

https://ebookmeta.com/product/beginning-android-5th-edition-get-
started-building-apps-for-the-android-platform-grant-allen/

ebookmeta.com

Android Apps for Absolute Beginners, 4th Edition Wallace


Jackson

https://ebookmeta.com/product/android-apps-for-absolute-beginners-4th-
edition-wallace-jackson/

ebookmeta.com

Android Studio Arctic Fox Essentials Java Edition


Developing Android Apps Using Android Studio 2020 31 and
Java Neil Smyth
https://ebookmeta.com/product/android-studio-arctic-fox-essentials-
java-edition-developing-android-apps-using-android-studio-2020-31-and-
java-neil-smyth/
ebookmeta.com

Handbook of Quality of Life for Individuals with Autism


Spectrum Disorder Justin B Leaf Joseph H Cihon Julia L
Ferguson Peter F Gerhardt
https://ebookmeta.com/product/handbook-of-quality-of-life-for-
individuals-with-autism-spectrum-disorder-justin-b-leaf-joseph-h-
cihon-julia-l-ferguson-peter-f-gerhardt/
ebookmeta.com
Xanathar s Guide to Everything Limited Edition 5th Edition
D D Jeremy Crawford

https://ebookmeta.com/product/xanathar-s-guide-to-everything-limited-
edition-5th-edition-d-d-jeremy-crawford/

ebookmeta.com

Bronze Age Monuments and Bronze Age Iron Age Roman and
Anglo Saxon Landscapes at Cambridge Road Bedford 1st
Edition Andy Chapman
https://ebookmeta.com/product/bronze-age-monuments-and-bronze-age-
iron-age-roman-and-anglo-saxon-landscapes-at-cambridge-road-
bedford-1st-edition-andy-chapman/
ebookmeta.com

Archie Goodwin s Office Nero Wolfe Speaking Sandy Lerner


Et El

https://ebookmeta.com/product/archie-goodwin-s-office-nero-wolfe-
speaking-sandy-lerner-et-el/

ebookmeta.com

Visualisation and Epistemological Access to Mathematics


Education in Southern Africa 1st Edition Marc Schäfer

https://ebookmeta.com/product/visualisation-and-epistemological-
access-to-mathematics-education-in-southern-africa-1st-edition-marc-
schafer/
ebookmeta.com

Women in Presidential Cabinets Power Players or Abundant


Tokens 1st Edition Maria C. Escobar-Lemmon

https://ebookmeta.com/product/women-in-presidential-cabinets-power-
players-or-abundant-tokens-1st-edition-maria-c-escobar-lemmon/

ebookmeta.com
Field guide to the frogs of Australia Second Edition
Michael J Tyler J Dale Roberts

https://ebookmeta.com/product/field-guide-to-the-frogs-of-australia-
second-edition-michael-j-tyler-j-dale-roberts/

ebookmeta.com
Android
for Absolute
Beginners
Getting Started with Mobile Apps
Development Using the Android Java SDK

Grant Allen

WOW! eBook
www.wowebook.org
Android for Absolute
Beginners
Getting Started with Mobile Apps
Development Using the Android Java SDK

Grant Allen

WOW! eBook
www.wowebook.org
Android for Absolute Beginners: Getting Started with Mobile Apps Development
Using the Android Java SDK
Grant Allen
LONDON, UK

ISBN-13 (pbk): 978-1-4842-6645-8 ISBN-13 (electronic): 978-1-4842-6646-5 


https://doi.org/10.1007/978-1-4842-6646-5

Copyright © 2021 by Grant Allen


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the
material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation,
broadcasting, reproduction on microfilms or in any other physical way, and transmission or information
storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now
known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with
every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an
editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the
trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not
identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to
proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of publication,
neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or
omissions that may be made. The publisher makes no warranty, express or implied, with respect to the
material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Steve Anglin
Development Editor: Matthew Moodie
Coordinating Editor: Mark Powers
Cover designed by eStudioCalamar
Cover image by Dollar Gill on Unsplash (www.unsplash.com)
Distributed to the book trade worldwide by Apress Media, LLC, 1 New York Plaza, New York, NY 10004,
U.S.A. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer-sbm.com, or visit www.
springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer
Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for reprint,
paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and
licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales
web page at http://www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is available to
readers on GitHub via the book’s product page, located at www.apress.com/978-1-4842-6645-8. For more
detailed information, please visit http://www.apress.com/source-­code.
Printed on acid-free paper

WOW! eBook
www.wowebook.org
To all the aspiring new Android developers in the world,
may you have fun while you learn to build new and wonderful applications!

WOW! eBook
www.wowebook.org
Table of Contents
About the Author�����������������������������������������������������������������������������������������������������xv
About the Technical Reviewer�������������������������������������������������������������������������������xvii
Acknowledgments��������������������������������������������������������������������������������������������������xix
Introduction������������������������������������������������������������������������������������������������������������xxi


■Part I: Get Android, Get Started���������������������������������������������������������� 1

■Chapter 1: Introducing Android����������������������������������������������������������������������������� 3
Working with Android: The Best Parts������������������������������������������������������������������������������ 3
Working with Android: The Challenges����������������������������������������������������������������������������� 5
Understanding Android’s Heritage and How It Affects You����������������������������������������������� 6
Understanding Android’s Future��������������������������������������������������������������������������������������� 9
What to Expect for the Rest of This Book������������������������������������������������������������������������� 9
Detailing More of the Remaining Chapters��������������������������������������������������������������������������������������������� 9


■Chapter 2: Introducing Android Studio���������������������������������������������������������������� 13
Understanding What Is Meant by Integrated Development Environment, or IDE������������ 13
The History and Provenance of Android Studio�������������������������������������������������������������� 14
Downloading the Android Studio Installer for Your Platform���������������������������������������������������������������� 14
Working with Android Studio Versions�������������������������������������������������������������������������������������������������� 15
Understanding How Android Studio and the Android SDK Work Together�������������������������������������������� 16

WOW! eBook
www.wowebook.org
vi Table of Contents

Preparing for Android Studio������������������������������������������������������������������������������������������ 16


Choosing Desktop or Laptop Hardware for Android Development�������������������������������������������������������� 16
Choosing the Operating System for Your Computer����������������������������������������������������������������������������� 17
Continuing with Android Studio Setup After Installation����������������������������������������������������������������������� 20

Working with Alternatives to Android Studio������������������������������������������������������������������ 30


Eclipse�������������������������������������������������������������������������������������������������������������������������������������������������� 31
IntelliJ IDEA������������������������������������������������������������������������������������������������������������������������������������������ 31
Tools That Target Multiple Operating Systems and Mobile Platforms��������������������������������������������������� 32
Traditional Platform-Agnostic Development Tools�������������������������������������������������������������������������������� 32


■Chapter 3: Your First Android Application, Already!�������������������������������������������� 33
Creating Your First Android Virtual Device���������������������������������������������������������������������� 33
Creating Your First Android Application, Already!����������������������������������������������������������� 41
Getting Your First Code Written������������������������������������������������������������������������������������������������������������� 46
Getting Ready to Run Your Application������������������������������������������������������������������������������������������������� 48
Installing (Additional) SDK Packages���������������������������������������������������������������������������������������������������� 50
Running Your Application���������������������������������������������������������������������������������������������������������������������� 52


■Chapter 4: Exploring Your First Project��������������������������������������������������������������� 55
Viewing the Whole Android Project Structure���������������������������������������������������������������� 55
Working with Manifests������������������������������������������������������������������������������������������������������������������������ 56
Jiving with Java������������������������������������������������������������������������������������������������������������������������������������ 58
Getting Resourceful with Resources���������������������������������������������������������������������������������������������������� 58
Building Everything with Gradle Files��������������������������������������������������������������������������������������������������� 60

Explaining the Key Android Application Logical Building Blocks������������������������������������ 63


Activities����������������������������������������������������������������������������������������������������������������������������������������������� 63
Intents��������������������������������������������������������������������������������������������������������������������������������������������������� 63
Services������������������������������������������������������������������������������������������������������������������������������������������������ 63
Content Providers��������������������������������������������������������������������������������������������������������������������������������� 64

Summary������������������������������������������������������������������������������������������������������������������������ 64

WOW! eBook
www.wowebook.org
Table of Contents vii


■Chapter 5: Android Studio In-Depth��������������������������������������������������������������������� 65
Starting with the Project Explorer���������������������������������������������������������������������������������� 65
Getting Comfortable Switching Project Explorer Views������������������������������������������������������������������������ 66
Using the Project Explorer Context Menu��������������������������������������������������������������������������������������������� 68

Running and Debugging with Android Studio����������������������������������������������������������������� 68


Running with Run Configs: A Recap����������������������������������������������������������������������������������������������������� 68
Running Farther with AVDs and Connected Devices���������������������������������������������������������������������������� 70
Debugging Instead of Running Your Code���������������������������������������������������������������������� 77
Setting and Clearing Breakpoints��������������������������������������������������������������������������������������������������������� 77
Starting Applications for Debugging����������������������������������������������������������������������������������������������������� 78
Stepping Through Code While Debugging�������������������������������������������������������������������������������������������� 80
Attaching the Debugger������������������������������������������������������������������������������������������������������������������������ 80

Viewing What You’ve Run����������������������������������������������������������������������������������������������� 81


Understanding Your Build��������������������������������������������������������������������������������������������������������������������� 81
Understanding Events in the Event Log������������������������������������������������������������������������������������������������ 82
Understanding Logcat�������������������������������������������������������������������������������������������������������������������������� 83

Revisiting the SDK Manager������������������������������������������������������������������������������������������� 84


Highlighting the Other Major Features of Android Studio����������������������������������������������� 86
Summary������������������������������������������������������������������������������������������������������������������������ 86

■Chapter 6: Mastering Your Entire Developer Ecosystem������������������������������������� 87
Choosing Dedicated Developer Hardware���������������������������������������������������������������������� 87
Determining Which CPU Is Right for You����������������������������������������������������������������������������������������������� 88
Too Much Memory Is Never Enough!���������������������������������������������������������������������������������������������������� 88
Storing It All!����������������������������������������������������������������������������������������������������������������������������������������� 89
Viewing It All!���������������������������������������������������������������������������������������������������������������������������������������� 90
Connecting It All!���������������������������������������������������������������������������������������������������������������������������������� 93

Test Handsets and Tablets���������������������������������������������������������������������������������������������� 93


Option 1: All-Virtual Testing������������������������������������������������������������������������������������������������������������������ 94
Option 2: Start Virtual and Augment with Top Devices�������������������������������������������������������������������������� 94
Option 3: Buy, Buy, and Buy Some More����������������������������������������������������������������������������������������������� 94
Option 4: Other People’s Hardware������������������������������������������������������������������������������������������������������� 95

WOW! eBook
www.wowebook.org
viii Table of Contents

Building with Build Tools������������������������������������������������������������������������������������������������ 96


Update Your gradle.properties File������������������������������������������������������������������������������������������������������� 96
Use the Gradle Command Line������������������������������������������������������������������������������������������������������������� 97
Visit gradle.org to Learn More�������������������������������������������������������������������������������������������������������������� 98

Managing Your Code with Source Control���������������������������������������������������������������������� 98


Completing Your Software Repertoire���������������������������������������������������������������������������� 99
Summary���������������������������������������������������������������������������������������������������������������������� 101


■Part II: Get the Android Development Know-how��������������������������� 103

■Chapter 7: Introducing Java for Android Development������������������������������������� 105
Java, Java, Everywhere������������������������������������������������������������������������������������������������ 106
Android’s Java Time Warp������������������������������������������������������������������������������������������������������������������ 107
Using a JDK Installation for Learning Java����������������������������������������������������������������������������������������� 107

Your First Java Concepts in Code��������������������������������������������������������������������������������� 109


The Key Java Building Blocks for Android Development���������������������������������������������� 112
Structure of Code�������������������������������������������������������������������������������������������������������������������������������� 113
Understanding Object-Oriented Design, Classes, and Objects����������������������������������������������������������� 114
Working with Class Methods and Data Members������������������������������������������������������������������������������� 114

Summary���������������������������������������������������������������������������������������������������������������������� 116

■Chapter 8: Introducing XML for Android Development�������������������������������������� 117
Getting Started with XML��������������������������������������������������������������������������������������������� 117
XML Version and Encoding����������������������������������������������������������������������������������������������������������������� 118
XML Elements������������������������������������������������������������������������������������������������������������������������������������� 118
XML Attributes������������������������������������������������������������������������������������������������������������������������������������ 120
XML Values����������������������������������������������������������������������������������������������������������������������������������������� 121
XML Namespaces������������������������������������������������������������������������������������������������������������������������������� 122

Other Parts of the XML World��������������������������������������������������������������������������������������� 123


Using XML in Your Android Applications����������������������������������������������������������������������� 124
Reviewing the Android Manifest XML File������������������������������������������������������������������������������������������ 124

WOW! eBook
www.wowebook.org
Table of Contents ix

Using XML for Resource Definitions��������������������������������������������������������������������������������������������������� 125


Defining Activity Layouts with XML���������������������������������������������������������������������������������������������������� 128

Summary���������������������������������������������������������������������������������������������������������������������� 130

■Chapter 9: Exploring Android Concepts: Core UI Widgets��������������������������������� 131
Everything Starts with View����������������������������������������������������������������������������������������� 131
Key Methods Derived from View��������������������������������������������������������������������������������������������������������� 132
Key Attributes and Properties Derived from View������������������������������������������������������������������������������� 132
Introducing the Core UI Widgets in Android������������������������������������������������������������������ 132
Labeling Things with TextView����������������������������������������������������������������������������������������������������������� 133
Buttoning the Perfect UI��������������������������������������������������������������������������������������������������������������������� 138
Getting the Picture with ImageView and ImageButton����������������������������������������������������������������������� 142
Editing and Inputting Text with EditText���������������������������������������������������������������������������������������������� 144
Checking Out the CheckBox��������������������������������������������������������������������������������������������������������������� 147
Switching It Up with a Switch������������������������������������������������������������������������������������������������������������� 150
Choosing Things with Radio Buttons�������������������������������������������������������������������������������������������������� 153

Learning Even More UI Widgets����������������������������������������������������������������������������������� 155


Summary���������������������������������������������������������������������������������������������������������������������� 155

■Chapter 10: Exploring Android Concepts: Layouts and More���������������������������� 157
What Is Android Jetpack����������������������������������������������������������������������������������������������� 157
Using Popular Layout Designs�������������������������������������������������������������������������������������� 159
Revisiting the Constraint Layout��������������������������������������������������������������������������������������������������������� 159
Using Relative Layouts����������������������������������������������������������������������������������������������������������������������� 164
Lining Up with Linear Layouts������������������������������������������������������������������������������������������������������������ 170

Even More Layout Options�������������������������������������������������������������������������������������������� 176


Table Layouts�������������������������������������������������������������������������������������������������������������������������������������� 176
Grid Layouts���������������������������������������������������������������������������������������������������������������������������������������� 177

Mastering XML-Based Layouts with Java Logic: The Best of Both Worlds!������������������ 177
Connecting XML Layout Definition in Java Code�������������������������������������������������������������������������������� 178

Revisiting MyFirstApp via ButtonAgain������������������������������������������������������������������������ 179


Summary���������������������������������������������������������������������������������������������������������������������� 181

WOW! eBook
www.wowebook.org
x Table of Contents


■Chapter 11: Understanding Activities���������������������������������������������������������������� 183
Delving into the Android Activity Lifecycle������������������������������������������������������������������� 183
Understanding Activity Lifecycle Callback Methods��������������������������������������������������������������������������� 185
Appreciating the Objectives of the Activity Lifecycle�������������������������������������������������������������������������� 189

Managing Activity Configuration Changes�������������������������������������������������������������������� 190


Working with the Default Approach to Configuration Change������������������������������������������������������������ 190
Summary���������������������������������������������������������������������������������������������������������������������� 191

■Chapter 12: Introducing Fragments������������������������������������������������������������������ 193
Starting with the Fragment Class��������������������������������������������������������������������������������� 193
Using Fragment-Based Design for Your Applications������������������������������������������������������������������������� 194
Working with the Fragment Lifecycle������������������������������������������������������������������������������������������������� 195
Reviewing the Fragment Lifecycle Callback Methods������������������������������������������������������������������������ 196

Starting Simple with Fragment Lifecycle Events��������������������������������������������������������� 198


Creating a Fragment-Based Application��������������������������������������������������������������������������������������������� 198
Selecting Which Layout to Inflate������������������������������������������������������������������������������������������������������� 200

Coding for Fragments��������������������������������������������������������������������������������������������������� 201


ColorFragmentExample in Action��������������������������������������������������������������������������������� 203
Summary���������������������������������������������������������������������������������������������������������������������� 206


■Part III: Get Sophisticated��������������������������������������������������������������� 207

■Chapter 13: Working with Sound, Audio, and Music for Android���������������������� 209
Playing Back Audio������������������������������������������������������������������������������������������������������� 209
Choosing Your Audio Approach����������������������������������������������������������������������������������������������������������� 209

Working with the Media Package��������������������������������������������������������������������������������� 210


Creating an Audio Application�������������������������������������������������������������������������������������� 211
Choosing Between Assets and Resources������������������������������������������������������������������������������������������ 211
Writing the Code for Audio Playback�������������������������������������������������������������������������������������������������� 212
Playing Back Audio the Simple Way��������������������������������������������������������������������������������������������������� 213
Coding the Java Logic for AudioPlayExample������������������������������������������������������������������������������������� 214

WOW! eBook
www.wowebook.org
Table of Contents xi

Using Streaming for Audio Playback���������������������������������������������������������������������������� 217


Playing the Music Stream������������������������������������������������������������������������������������������������������������������� 220

Exploring Other Playback Options�������������������������������������������������������������������������������� 220


Recording Audio����������������������������������������������������������������������������������������������������������� 221
Recording Audio with MediaRecorder������������������������������������������������������������������������������������������������ 221

Expanding Your Developer Audio Toolset���������������������������������������������������������������������� 227


Understanding Key Audio Aspects������������������������������������������������������������������������������������������������������ 228
Choosing Further Audio Tools������������������������������������������������������������������������������������������������������������� 229

Summary���������������������������������������������������������������������������������������������������������������������� 231

■Chapter 14: Working with Video and Movies for Android���������������������������������� 233
Playing Back Video������������������������������������������������������������������������������������������������������� 233
Designing a VideoView-Based Layout������������������������������������������������������������������������������������������������ 234
Controlling Video Playback in Your Code�������������������������������������������������������������������������������������������� 236

Understanding Key Video Concepts������������������������������������������������������������������������������ 239


Bitrate������������������������������������������������������������������������������������������������������������������������������������������������� 239
Frame Rate����������������������������������������������������������������������������������������������������������������������������������������� 240
Codecs������������������������������������������������������������������������������������������������������������������������������������������������ 240
Understanding the Complex World of Video Containers and Child Codecs����������������������������������������� 241

Expanding Your Developer Video Toolset���������������������������������������������������������������������� 243


Reviewing the Range of Video Editing Tools Available to You������������������������������������������������������������� 243
Popular Open Source Video Editing Suites����������������������������������������������������������������������������������������� 244
Popular Commercial Video Editing Suites������������������������������������������������������������������������������������������� 244

Introducing HandBrake for Video Editing��������������������������������������������������������������������� 245


Downloading and Installing HandBrake���������������������������������������������������������������������������������������������� 245
Running and Using HandBrake����������������������������������������������������������������������������������������������������������� 245
Going Further with Video for Android�������������������������������������������������������������������������������������������������� 249

Summary���������������������������������������������������������������������������������������������������������������������� 249

WOW! eBook
www.wowebook.org
xii Table of Contents


■Chapter 15: Introducing Notifications��������������������������������������������������������������� 251
Configuring Notifications���������������������������������������������������������������������������������������������� 251
Customizing Notifications with the Notification Object���������������������������������������������������������������������� 252
Adding Icons for Notifications������������������������������������������������������������������������������������������������������������ 255
Introducing Notification Channels in API Level 26������������������������������������������������������������������������������ 256

Notifications in Action�������������������������������������������������������������������������������������������������� 257


Supporting Logic to Create the Notifications�������������������������������������������������������������������������������������� 257

Seeing Notifications from the User’s Perspective�������������������������������������������������������� 260


Summary���������������������������������������������������������������������������������������������������������������������� 264

■Chapter 16: Exploring Device Capabilities with Calls���������������������������������������� 265
Calling the Shots���������������������������������������������������������������������������������������������������������� 265
Specifying Telephony Support������������������������������������������������������������������������������������������������������������ 265
Making Telephony Support Optional��������������������������������������������������������������������������������������������������� 266

Making Calls����������������������������������������������������������������������������������������������������������������� 266


Laying Out the CallExample Application��������������������������������������������������������������������������������������������� 267
Working Logic for the CallExample Application���������������������������������������������������������������������������������� 270
Making an ACTION_DIAL Call�������������������������������������������������������������������������������������������������������������� 271
Making an ACTION_CALL Call������������������������������������������������������������������������������������������������������������� 272

Handling Incoming Calls����������������������������������������������������������������������������������������������� 273


■Part IV: Get Together����������������������������������������������������������������������� 275

■Chapter 17: Understanding Intents, Events, and Receivers������������������������������� 277
Introducing Android Intents������������������������������������������������������������������������������������������ 277
Understanding Intent Behavior����������������������������������������������������������������������������������������������������������� 278
Understanding Intent Routing������������������������������������������������������������������������������������������������������������� 280

Including Intents in Your Manifest�������������������������������������������������������������������������������� 280


Using Android’s Verified Links������������������������������������������������������������������������������������������������������������ 282

Seeing Intent-Launched Activities in Action����������������������������������������������������������������� 282


Deciding on Activity Dependency������������������������������������������������������������������������������������������������������� 282

Creating an Intent��������������������������������������������������������������������������������������������������������� 283


Starting the Intent-Invoked Activity���������������������������������������������������������������������������������������������������� 284

WOW! eBook
www.wowebook.org
Table of Contents xiii

Introducing Receivers�������������������������������������������������������������������������������������������������� 288


Using Receivers When No UI Is Needed���������������������������������������������������������������������������������������������� 289
Working with Receiver Limitations����������������������������������������������������������������������������������������������������� 289

Summary���������������������������������������������������������������������������������������������������������������������� 290

■Chapter 18: Introducing Android Services�������������������������������������������������������� 291
Services Background��������������������������������������������������������������������������������������������������� 291
Using WorkManager as an Alternative to Services����������������������������������������������������������������������������� 292

Starting with Your Own Service������������������������������������������������������������������������������������ 292


Implementing Your Service Class������������������������������������������������������������������������������������������������������� 292
Managing the Service Lifecycle via Callbacks����������������������������������������������������������������������������������� 293

Providing Manifest Entries for Your Service����������������������������������������������������������������� 294


Service Communication���������������������������������������������������������������������������������������������������������������������� 294

Service-to-Client Communication�������������������������������������������������������������������������������� 297


Using bindService( ) Methods for All Communication������������������������������������������������������������������������� 298
Intents and Broadcast Receivers�������������������������������������������������������������������������������������������������������� 298
Use PendingIntent Objects����������������������������������������������������������������������������������������������������������������� 298
Use Messenger and Message Objects������������������������������������������������������������������������������������������������ 299
Use Independent Messaging�������������������������������������������������������������������������������������������������������������� 299
Create Callbacks and Listeners���������������������������������������������������������������������������������������������������������� 299
Use Notifications�������������������������������������������������������������������������������������������������������������������������������� 300
Services in Action��������������������������������������������������������������������������������������������������������� 300
Choosing the Service Design�������������������������������������������������������������������������������������������������������������� 300
Creating the Java Logic for the Service���������������������������������������������������������������������������������������������� 300
Creating an Example Client to Use the Service���������������������������������������������������������������������������������� 302
Testing the Service in Action�������������������������������������������������������������������������������������������������������������� 304

Summary���������������������������������������������������������������������������������������������������������������������� 304

■Chapter 19: Working with Files in Android�������������������������������������������������������� 305
Using Assets and Raw Files����������������������������������������������������������������������������������������� 305
Populating Lists from Resource Files������������������������������������������������������������������������������������������������� 306
Working with Files from the File System�������������������������������������������������������������������������������������������� 310

WOW! eBook
www.wowebook.org
xiv Table of Contents

Android’s File System Model�������������������������������������������������������������������������������������������������������������� 310


Permissions for Reading and Writing Files����������������������������������������������������������������������������������������� 311

Examining External Files in Action������������������������������������������������������������������������������� 312


What Goes into Saving and Reading Files������������������������������������������������������������������������������������������ 315
Saving and Reading Files in Action���������������������������������������������������������������������������������������������������� 317

Ensuring External Storage Is Available When Needed�������������������������������������������������� 319


Other Considerations with Android File Systems�������������������������������������������������������������������������������� 320

Summary���������������������������������������������������������������������������������������������������������������������� 322

■Chapter 20: Working with Databases in Android����������������������������������������������� 323
Working with SQLite: The World’s Most Popular Database!����������������������������������������� 323
Quickly Learning SQLite for Android Development������������������������������������������������������� 324
Creating SQLite Databases for Your Applications������������������������������������������������������������������������������� 325
Introducing the SQLiteExample Application���������������������������������������������������������������������������������������� 326
Creating a Database-Driven Activity��������������������������������������������������������������������������������������������������� 330
Choosing Query Approaches for SQLite and Android�������������������������������������������������������������������������� 333
Managing Results from Queries with Cursors������������������������������������������������������������������������������������ 335

Modifying Data with Your Android Application������������������������������������������������������������� 337


Inserting Data������������������������������������������������������������������������������������������������������������������������������������� 337
Updating Data������������������������������������������������������������������������������������������������������������������������������������� 339
Deleting Data�������������������������������������������������������������������������������������������������������������������������������������� 339

Using the Room Persistence Library���������������������������������������������������������������������������� 340


Packaging and Managing SQLite Databases for Android��������������������������������������������� 340
Managing Android Storage for Database Performance���������������������������������������������������������������������� 340
Packaging SQLite Databases with Your Applications�������������������������������������������������������������������������� 341

Choosing SQLite Management Tools to Prepare Databases for Packaging������������������ 342


Working with Built-In Tools����������������������������������������������������������������������������������������������������������������� 342
Working with Third-Party Database Tools������������������������������������������������������������������������������������������� 342

Summary���������������������������������������������������������������������������������������������������������������������� 343


■Index ������������������������������������������������������������������������������������������������������������������ 345

WOW! eBook
www.wowebook.org
About the Author
Grant Allen, PhD, has worked in the technology field for over 20 years, as a CTO,
entrepreneur, and emerging technology expert. After successful startup exits and a decade
at Google, Grant’s focus is now mentoring and coaching startups and hi-tech companies
on building great teams and great technology. He is a frequent speaker on topics such as
big data, mobile ecosystems, Android, wearables, IoT, disruptive innovation, and more.
Grant has a PhD in computer science based on research he performed while at Google and
an MBA specializing in technology management, and he is the author of seven books on
various mobile platform and data technology topics.

xv

WOW! eBook
www.wowebook.org
Another Random Scribd Document
with Unrelated Content
legszőkébbek fajából, azt az úgyszólván kezdetleges arcát mutatta,
mely még langyosan a párnáktól, festék nélkül, kikészítetlenül,
valami ősi fehérséggel lepte meg az embert, a szemek fényétől
majdnem kékre világítva.
– Mi történt? – kérdezte.
De már meg is pillantotta az apját, lovagolvást a plafondon s
rögtön elájult, az ajtószárnynak dőlve, félmeztelen a pongyolájában.
Egy hangja nem volt, egy sóhaja sem, semmi. Inkább csak el volt
szörnyedve a lelkében.
Ebben a pillanatban érkezett meg, számos kísérettel, Muzsa
László csendőrkapitány, s amint meglátta az asszonyt, borzongva a
küszöbön selyemfátylaiban, legott hozzásietett és lágyan felemelte
valami táncos mozdulattal, de egy bernáthegyi komolyságával. Egy
pár gyöngéd szót is szólott, mint régi barátja a családnak, aki ismeri
a hangot és inkább csak térítgette mint vigasztalta és végül
mentegette magát:
– Borzasztóan sajnálom, – ezt mondta, – hogy ilyen bús esetben
kellett jönnöm, Dóra. Sohase hittem volna… Sajnos, nem lehetett
kitérnem, egyedül vagyok Mosonban, inspekciós, már annyit
mulasztottam.
S azzal, nagyobbszerű izgalmak nélkül, felkísértette az asszonyt a
szobájába. Aztán rögtön hozzáfogott a helyszíni szemléhez a
csendőrökkel s a jegyzővel s először is felnézett a plafondra, a
csillárra, a kampóra, a hullára, aztán mindent megnézett a szobában
s megint felnézett a plafondra, a csillárra, a kampóra, az öreg Pejérdi
»függő helyzeté«-re, ahogy ezt bediktálta s megint a szobát
vizsgálta apróra, az ágyat a sarokban s a széket mellette s külön
minden bútort, szőnyeget és mindent és külön a zongorát az
állvánnyal s a kótával rajta, amint visszalapozott a címlapjáig, hogy
elolvassa s aztán bediktálja:
– A zongorán pedig: Beethoven, Les Adieux-szonáta.
Azzal befejezvén a jegyzőkönyveket, a holttestet végre leoldották
a szegről, miközben a csillár, felborzolva ugyan, de visszaingott a
helyére s még ingott egy darabig. Leoldván az öreg Pejérdi nyakáról
egy félrőfnyi zsinórt, ami az egyik ablakfüggönyről hiányzott, merev
testi formáját befektették az ágyba, immár a körorvos segédletével,
aki időközben megjelent. S amint meghatva, kitünő ember, a párnák
fölé hajolt s nézte a kis zord öreget akit húsz év óta ismert, s a
hurok nyomát is nézte a nyakon, egyszerre csak nagyon furcsán
nézett a szemüvegje alól s úgy fordult vissza, valahogy elkínlódva, a
lelkiismerete szövevényében:
– Megtetszett állapítani az öngyilkosságot? – kérdezte rémüldöző
alázattal Muzsa kapitánytól. – Nem tudom micsoda egyéb sérülések
ezek itt a nyakon, a hurok nyoma mellett.
A csendőrtiszt az ajkába harapott. Nagy szál sovány ember volt,
bánatos arckifejezéssel, de egészben kemény a talpán, hajlékony
mint a gyík s aki nyilván nem értett tréfát. Egyet lépett az ágy felé,
az ujját pattogtatva. S két bús szeme, a hullának szegeződve, arra a
rejtélyes és ijesztő lángra gyulladt, ami a bűnügyi kutatók
szembogarában mintha valami külön lámpa volna. Még nézte ezt a
préselt nyakat s a hurok nyomát és a sérüléseket. Igy telt el egy
hosszú perc, az élőkkel s a hullával, halálos csendben. Aztán hirtelen
visszafordult s megint fölnézett a plafondra, a csillárra s a csillár alatt
a zongorát nézte, elborult számítgatással, amint az állvány mögül, a
hangszer fedelétől a plafondig, fölmérte a távolságot. És maga köré
pillantva, egy lépést tett, visszajött, a vállát vonogatta s lehajolt
hirtelen. A szék lábánál, a szőnyegen, egy kevés hamut talált. Az
öreg nem volt szivaros ember, tünődött el magában. Valaki elszítt
egy cigarettát itt, a munkáját befejezve, – fűzte tovább. – Ezt nem
lett volna szabad, – gondolta azzal a szakértő fölénnyel, amellyel
bűnügyi nyomozók magát a bűnügyet kritizálják, a végrehajtás s a
tettes bravurja szempontjából. – Ezt nem lett volna szabad, –
fontolgatta és sóhajtozva mosolygott is a biztos nyomra, arra az örök
és szubtilis hibára, amellyel az ember, egy csipetnyi hamut hintve el
az útján, már meg is mutatja, hol jöjjenek utána. Elmerülve, a
bajuszát gyötörgető ujjakkal leült a zongora elé, az állványnak
meredve, mozdulatlanul. Vajjon mit gondolt, mit követett, micsoda
rejtélyes szálakat s titkokat e tragédia homályában, ahol egy kevés
hamu, a szőnyegről felkaparva, szinte szimbólikusan jelezte emberi
céljaink minden hiúságát. Mit gondolt, mit keresett, hova szállott le,
micsoda éjszakába mind komorabb homlokával, amikor csöndesen a
kótában kezdett lapozgatni, mint Sybillák könyvében, az állványon,
előtte.
– Az Abschied-szonáta! – mondotta most a népiesebb német
címet a francia után, s csak lapozott a kótában. S megállott minden
oldalnál, minden tételnél, a kótafejek sűrű tömegébe mélyedve, mint
hieroglifákba. – L’adieu, Adagio, Allegro, – mondogatta magának, az
értelmeket kutatva. S megint tovább, amint az egyes tételek címét
olvasta: L’absence, Andante expressivo, – s már az utolsó oldalakat
nézte. – Attacca, Vivacissamente, – rebegte eltünődve. S
megismételte: Vivacissamente!
Mit jelentett ez? Mit látott, mit érzett e nyomtatásos szöveg holt
betűiből itt? Micsoda forróság szállott e röpke szavakból eltikkadt
világukban, mint egy erdőben, ami hallgat? Micsoda méreg e
kótafejekből, melyek metodikusan a sorokba ékelve, mint apró
virágok remegtek feltűzdelve, hosszú száraikban? Hová torlódott
mindez zengő tulipánözönével, attacca! vivacissamente! Hová
sodorta az embert, halálos tömegével, micsoda egekbe, magasba,
mélységbe, micsoda tébolyba s kétségbeesésekbe, hogy a kapitány,
hirtelen felkiáltott:
– Itt van a gyilkosság kulcsa! – s az oldalak szélét sodorgatta és
tépte.
S azzal felállott, egy percig várt még, a végsőkig elgyötrődve.
– Kezdhetjük elülről, – szólott végre s intett a csendőröknek, akik
a falnak tapadva álltak s nem is lélekzettek.
S akkor megint sorra bejöttek kihallgatásra, az inas, a szobalány,
az éjjeli őr s a majorsági népek. Mind rögtön a csillárt nézték egy-
egy oldalpillantással s aztán sunyin, az uraság hült tetemét keresték
a szobában, hogy már csak a csillár lógott le a plafondról. S mind
beszédes volt már s mind ostoba s tudós, azzal a megtermékenyült
fantáziával, mely a mocsarak virágát hajtja az ilyen bűnesetek körül.
De senki nem tudott semmit. Az uraság zongorázott úgy éjféltájt
vagy éjfél után, amint azt szokta, ha nem tudott aludni s ezt
hallották a majorságban is. Az ajtót soha be nem zárta zsarnoki
önbizalmával, ezt is tudták s ezt tudta maga a kapitány is. Az éjjeli
őr, juhászbundásan, mint valami ősidőkről beszélt a mult éjszakáról,
álmokkal s rejtélyekkel tele. Egy autót is hallott zúgni Moson felől, a
pejérdi határban, ha jó a füle, holott tele van muslicával, merthogy
öreg ember. S valaki szaladt a dülőn, a sötétben, cigarettázva!
– Az én emberem! – rebegte Muzsa kapitány s kivetett maga elé,
bús szeme elé, elborulva, egy nagy árnyékot az éjszakába, mint Kain
árnyát, aki loholna, félig kéken a hold alatt, a répaföldek mentén.
S mégis, bosszusan hirtelen, elkergette a sok népet.
– Ezekkel kutatok én ilyen matériában?! – mondogatta magának.
– Ilyen faggyúgyertyákkal az ilyen éjszakában?! Ilyen parasztokkal
az ilyen sakktáblában?! Mind menjen! – mondotta s türelmetlenül
megint, megpattogtatta az ujját.
S az inas után kiáltott:
– A nagyságos asszonyt kérném, ha lefáradna ide.
De rögtön meggondolta, amint egy csendőr megindult, hogy az
inassal menjen.
– Ezt nem mondtam! – csattant ki a kapitány. – Mind marad.
Magam megyek. Ez így célravezetőbb lesz, ahogy én gondolom ezt,
– fordult a körorvoshoz, aki leült a jegyzővel egy sarokba.
Fenn, a küszöbön, az ajtó előtt, melynek meg kellett nyilnia, egy
nagyot lélekzett s hosszú csontos kezét a homlokán végigvonta, dús
haja tövében. Aztán kopogott, belépett, várt, hallgatott, míg Pejérdi
Dóra egy kis asztal mellől, ahol a tükörbe nézett, azt mondta:
– Oh istenem!
Egy csomó rózsa fölött egy vázában, amit magához vont remegő
cimpákkal, már nem volt olyan harmatosan sápadt, szűzleányos
haloványságokkal. De kiföstve sem volt arra a babyloni bálványra,
akinek a kapitány ismerte. Kendőző művészete az arca oválját egy
tragikus O betűvé nyujtotta a rézsútos száj szaggatott vonalával, ami
szinte elvágta az arcát s a két kék szeme merevségével, ami
kancsinak tűnt egy-egy pillanatra.
De hirtelen a csendőrtiszt feléje fordult:
– Ki volt itt magánál az éjjel, – kérdezte szemtül-szembe, – aki az
apját megfojtotta s aztán felhúzta a plafondra?
– Nálam?! Megőrült?! – dadogta a ferde szájával.
Mert csak azt hallotta, csak az érintette ebből az egész
tragédiából, ami e támadó modorban őt magát sujtotta. Az apját
látta volt a plafondon, holtan. Hogy öngyilkos lett, vagy megölték,
csak egy árnyalat volt abban az összhatásban, mely nyilván már le is
zajlott benne. S csak önmagáért vibrált, vérig sértve, mikor
lázadozón visszatámadt:
– Mintha azt csak úgy lehetett volna az apámtól, hogy én itt
éjszaka szeretőket fogadjak! – kiáltotta. – Amilyen hörcsög volt, de
hiszen tudja! ismerte! – tette hozzá, sírva fakadva.
– Az ember, úgy jött, hogy nem látta senki, – mondotta a
kapitány. – A pejérdi határban leszállt az autójáról s a szérüs
mentén, a kert alatt, beosont magához. Igy ment vissza is, a kis
dülőn, a sötétben. Ismerem a járást, lássa.
– Ha százszor ismeri is! – hadarta.
– No legyen okos, – szólott a tiszt, kötve magát. – Ki volt? Ezt
mondja meg, mielőtt kutatnom kellene utána.
– No de megőrült! esküszöm! megőrült! – ismételte, az asztalt
csapkodva.
S a kancsi szemével amint nézte:
– Amiért maga a fejébe vett engem, azért a pejérdi kastély még
nem bordély itten, no mondja! – fújta az arcába.
– Oh istenem! – felelte Muzsa kapitány, megbántva e hangra. –
Úgy látom, félreért engem, – folytatta. – Hogy a fejembe vettem,
micsoda gyerekbeszéd… Maga többet tud ennél. S valami szebbet is
mondhatna.
És olyan egyszerűen mondta ezt, a bús szeme kíséretével.
– Én itt vagyok Mosonban, az örsön, ha magammal kell, hogy
kezdjem, – mondta még, – s már nem is megyek egy tapodtat.
Lemondtam ambíciókról, karrierről, amúgy elegánsan, egy
kézlegyintéssel, – maga mind tudja ezt. Az volt a legjobb számomra,
ha itt lehettem Pejérden, ha nincs is mit keresnem magánál, – a
szíve másé, rég tudom ezt, no lássa! Szóval, úgy vagyok itt, minden
érdeken kívül, mint egy tisztességes ember s csak az igazságot
keresem.
– Hát csak keresse, – felelte kurtán s a rózsáit szagolta.
– Nem is tehetnék máskép, sőt! meg fogja látni milyen mélyre
szálltam, – folytatta a tiszt csendesen. – Ha tájékozottabb vagyok e
pillanatban, csak éppen az, hogy itt vagyok magával tavasz óta,
majdnem minden este. Ha jobban látok s többet tudok, mint amit
más csendőrtisztek látnának s tudnának az én helyemben mostan,
csak onnan van, hogy a barátja voltam, az egész szívemmel, no
igaz? Már most, értse meg, mi nem vívunk itt, mi ketten, valami élet-
halálharcot. Én nem vádolom magát, nem vonom e bűnügybe, –
mindahhoz, ami itt történt, magának semmi köze, bűnügyi
értelemben. Csak nekem van közöm ahhoz, sajnos, aki holtan fekszik
odalenn, megfojtva. Főleg közöm van ahhoz, hogy ki az, aki
megfojtotta? S mivel ez az ember magánál volt az éjjel, kérnem kell,
hogy megmondja.
– No de ki vagyok én, hogy gyilkosokkal hálok?! – kiáltotta a
hölgy felpattanva s az ajtó felé szaladt.
– Várjon csak, – szólott Muzsa kapitány, s elállta az útját. – Az
nem mindig a nőtől függ, hogy kivel hál, hogy úgy beszéljek a maga
modorában.
– Oh! – hebegte, a falnak tapadva.
– Mit tudhatja azt, kinek adja oda magát, – folytatta a tiszt a
gondolatát követve. – Ki lesz az holnap, aki ma volt, mit tudja? Hova
sodorhat egy pillanat egy embert? Hogy gurulhat el a sárba, akiről
maga mint egy istenről álmodott!
– No jól van, – felelte s megingott a fátylaiban, legyőzve. – Ha
ezt akarja, ha így dolgozik fortéllyal! itt vagyok megfogva, nem
bánom, – tette hozzá s megint leült a kis asztalához.
Egy percig várt még, a rózsái fölött, a tükör előtt, s hirtelen
elmerült a tükörben, azzal a szaggatott mozdulattal, ahogy a hattyú
hajtja a fejét a víz tükrébe, egy futó pillanatra. Az arca lágyan
földerengett abban a könnyed vidámságban, mellyel az ember a
maga igaza tudatában úgy esik bele csapdákba, hogy azt hiszi, mind
elkerülte azokat. És két kék szem egy női arcban soha szűziebben
nem égett és soha nő nem vonta össze a fátylait a keblén
szemérmetesebben, mint Pejérdi Dóra amikor bevallani készült, kivel
töltötte az éjjelt.
– Hát nézze csak, de ezt nem lehet csak így elmondani, így
kutyafuttába! ez az én életem, – lihegte, a haját simítgatva el
tündöklő homlokáról. – Maga tudja mit szenvedtem az apámmal, az
urammal is, maga tudja! Hogy micsoda kínjaim voltak, micsoda
fantáziákban, maga mind látta ezt, igaz? Ahogy éltem itt, halálra
epedten, ahogy szinte vártam, hogy lehulljak úgyszólván, mint akit
belülről már régen eltapostak. Az apám nyaggatta a zongoráját,
éjfélig is olykor, zenélő mániákus! – fújta a foga közt, fellobbanó
haraggal. – Én ültem mellette és csak ültem és hallgattam, óraszám,
elátkozva! De végre volt egy estém, egyszer végre, egy nagy estém,
– sóhajtott fel. S megállott tétován, lehajtott fejjel a rózsáin.
– Mondja csak tovább, – biztatta a tiszt.
– De hiszen maga is itt volt akkor este, – folytatta, – mikor
kijöttek hozzánk a főispánék Mosonból, azzal a tüneményes
Svendberggel, aki a vendégük volt akkor… Maga is látta, hallotta,
mikor leült a zongorához Svendberg, s játszott, emlékszik? Ivo
Svendberg!
– Hogy emlékszem-e? – felelte a vállát vonogatva, mint aki rég
rajta volt a nyomon, amelyre rá akarják vezetni.
– Már most tudja a többit, – folytatta elfúlva, az emlékei
nyügében, amint szinte összetört alatta. – Hogy ez mi volt, amikor
játszott, micsoda szőke tigris volt ez a zongorán, mikor játszott,
emlékszik? a szívünk megállott! Senki sem mozdult, senki nem merte
kérdezni amikor befejezte, mi volt az amit játszott, olyan transzban
volt, olyan halálosan sápadt. A grófné súgta oda az apámnak: az
Abschied-szonáta. Mert az apám, félőrülten, már meg is akarta
hozatni a kótát, még azon éjjel, hajnalban, egy lovasfutárral, egy
paraszttal az Abschied-szonátát, hogy ő azt megtanulja, játszani
fogja, Svendberg után, az Abschied-szonátát! az apám! no mondja!
És kacagott a hideg fogával, szájtátva.
– Mondja tovább, – biztatta megint a tiszt.
– Oh, szívesen, szívesen! – felelte, valami üde készséggel s
lobogva a fátylaiban. – Én kimentem a kertbe, én vele, egyedül! –
hebegte a fejét lehajtva, a két szemével a tükörben, mintha egy
tiltott képet nézne a tükörben, önmagát e képben, a lelke mélyéig
borzongva. – S azóta így van ez minden alkalommal, – folytatta, –
hogy lopva egy órát éjszaka, ha lehet, ez csakugyan, a mi két
szívünkkel, az Abschied-szonáta köztünk, amikor elválunk, – vallotta
be. – Igy volt ez ma éjszaka is lássa, – mondotta még s elhallgatott
a rózsáiban.
Aztán, hirtelen, egy sóhajtással, amint hozzátette:
– Nohát ez az a gyilkos, akit maga kifaggat belőlem, ez az a
gyilkos! – kacagta s felállott.
– Igen, – felelte a kapitány. – No várjon csak, hogy végre
megértsük egymást, hogy végre maga is segítsen, hogy ezt
kihámozzuk valahogy, ezt a rejtélyt… Mikor elváltak abban a
hangulatban, ahogy maga azt mondja, nem hallották, hogy az apja
játszik odalenn s éppen ezt az Abschied-szonátát játssza?
– De igen, – felelte meglepetten, – éppen azt nyaggatta.
– Már most, valamit kérdeznék utoljára, ha ide figyelne.
– Figyelek, – felelte, a két kék szemével mereven.
– Nem lehet az, – kérdezte a kapitány, – ahogy maga ismeri ezt a
Svendberget, ezt a szőke tigrist, ahogy mondja, nem lehet az, mit
gondol, hogy amint búcsúzva magától, még a karjaiban tartja, még a
két szemébe mélyed, abban a gyönyörében szóval ami volt magával
s ami még tart, ez a silány zongorajáték durván megzavarja a
kétségbeesésig?
– Ez lehet, igen, – felelte, – mert hiszen lerohant a lépcsőn.
– No lássa! Eltöltött egy órát magával, micsoda órát! Még
mámoros magától, amilyen bölény, ahogy szerethette magát! Nem
lehet az, hogy abban a kínos kalimpálásban ami felhangzik a füléhez,
abban a mániákus dörömbölésben a billentyűkön végig, ahogy az
apja játszott és elkínzott egy Beethovent, nem lehet az, hogy
minden szépséget a világon, minden gyönyört magával, hirtelen
megcsúfolva érezzen és lásson?
– Oh Istenem, igen, ez lehet, – rebegte.
– Nem lehet az, – folytatta a kapitány, – hogy amilyen ember,
amilyen művész főleg, a végsőkig feldúlva, beront egy kontárhoz,
megfojtja attacca! vivacissamente! felhúzza egy szögre s rágyujt egy
cigarettára, ahogy a munkáját befejezve, visszasiklik a régi
kerékvágásba?
– Ez lehet, igen, – felelte, – nagy Isten!
– No lássa.
– Igen, ez mind lehet, ez mind lehet, – hadarta, amint őt magát
is e mult éjszakája sodorta, a Svendberg lelke amint sodorta, amint
szállott utána mint egy sas után, micsoda csúcsokra!
De amint föleszmélt, hogy íme itt van kiadva, elárulva:
– És ha így is van, hát aztán?! Ki bánja?! – kiáltotta. – Ezt neki
szabad, ezt neki lehet, amilyen félisten, hát nem?! Hogy kiirtsa, ami
rút az útján, hogy akár ölni tudjon a szépségért, no nem?!
– De igen, – felelte Muzsa kapitány, – nem mondom, ezt neki
lehet, így művészileg felfogva. De én mégsem hagyhatom futni!
– Miért nem? – kérdezte elámulva, a rózsái fölött.
TARTALOM.

A mennyei küldönc 5
Két filozóf 79
A rejtély 86
A vendég 91
Történet egy ékiratból 97
Szalánczy Marietta 101
A mikói püspök 110
Görög mese 114
A szent tövis legendája 118
Kismama 122
Mózsi 136
Az emlékkönyv 143
Boldogító Kranz bácsi 151
A másik 161
A madarak nyelvén 168
Az utánzó 172
Nemes szív, rendes ember 177
Éjjel a Himaláján 181
A pejérdi gyilkosság 187
*** END OF THE PROJECT GUTENBERG EBOOK A MENNYEI
KÜLDÖNC ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.

You might also like