0% found this document useful (0 votes)
225 views80 pages

Android Studio 23 Development Essentials Neil Smyth Instant Download

The document provides an overview of various Android Studio development essentials, including links to multiple editions of Neil Smyth's books on Android development. It covers topics such as setting up the development environment, creating Android applications, and utilizing Android Studio features. Additionally, it includes detailed sections on Android architecture, application lifecycles, layout design, and event handling.

Uploaded by

asplicashes
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
0% found this document useful (0 votes)
225 views80 pages

Android Studio 23 Development Essentials Neil Smyth Instant Download

The document provides an overview of various Android Studio development essentials, including links to multiple editions of Neil Smyth's books on Android development. It covers topics such as setting up the development environment, creating Android applications, and utilizing Android Studio features. Additionally, it includes detailed sections on Android architecture, application lifecycles, layout design, and event handling.

Uploaded by

asplicashes
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/ 80

Android Studio 23 Development Essentials Neil

Smyth download

https://ebookbell.com/product/android-studio-23-development-
essentials-neil-smyth-50654020

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Android Studio 32 Development Essentials Kotlin Edition Developing


Android 9 Apps Using Android Studio 32 Kotlin And Android Jetpack
Smyth

https://ebookbell.com/product/android-studio-32-development-
essentials-kotlin-edition-developing-android-9-apps-using-android-
studio-32-kotlin-and-android-jetpack-smyth-35703616

Android Studio 32 Development Essentials Kotlin Edition Developing


Android 9 Apps Using Android Studio 32 Kotlin And Android Jetpack Neil
Smyth

https://ebookbell.com/product/android-studio-32-development-
essentials-kotlin-edition-developing-android-9-apps-using-android-
studio-32-kotlin-and-android-jetpack-neil-smyth-37362580

Android Studio 32 Development Essentials Kotlin Edition Developing


Android 9 Apps Using Android Studio 32 Kotlin And Android Jetpack
Smyth

https://ebookbell.com/product/android-studio-32-development-
essentials-kotlin-edition-developing-android-9-apps-using-android-
studio-32-kotlin-and-android-jetpack-smyth-36015834

Android Studio 2 Essentials 2nd Edition Zapata Belen Cruz

https://ebookbell.com/product/android-studio-2-essentials-2nd-edition-
zapata-belen-cruz-11858430
Android Studio 42 Development Essentials Java Edition Developing
Android Apps Using Android Studio 42 Java And Android Jetpack Neil
Smyth

https://ebookbell.com/product/android-studio-42-development-
essentials-java-edition-developing-android-apps-using-android-
studio-42-java-and-android-jetpack-neil-smyth-33967918

Android Studio 42 Development Essentials Kotlin Edition Developing


Android Apps Using Android Studio 42 Kotlin And Android Jetpack Neil
Smyth

https://ebookbell.com/product/android-studio-42-development-
essentials-kotlin-edition-developing-android-apps-using-android-
studio-42-kotlin-and-android-jetpack-neil-smyth-33967924

Android Studio 42 Development Essentials Kotlin Edition Developing


Android Apps Using Android Studio 42 Kotlin And Android Jetpack Smyth

https://ebookbell.com/product/android-studio-42-development-
essentials-kotlin-edition-developing-android-apps-using-android-
studio-42-kotlin-and-android-jetpack-smyth-32948188

Android Studio 42 Development Essentials Java Edition Developing


Android Apps Using Android Studio 42 Java And Android Jetpack Neil
Smyth

https://ebookbell.com/product/android-studio-42-development-
essentials-java-edition-developing-android-apps-using-android-
studio-42-java-and-android-jetpack-neil-smyth-34707492

Android Studio Flamingo Essentials Java Edition Developing Android


Apps Using Android Studio 202221 And Java Neil Smyth

https://ebookbell.com/product/android-studio-flamingo-essentials-java-
edition-developing-android-apps-using-android-studio-202221-and-java-
neil-smyth-51142446
Android Studio 2.3 Development Essentials – Android 7 Edition
© 2017 Neil Smyth / Payload Media, Inc. All Rights Reserved.
This book is provided for personal use only. Unauthorized use, reproduction
and/or distribution strictly prohibited. All rights reserved.
The content of this book is provided for informational purposes only. Neither the
publisher nor the author offers any warranties or representation, express or
implied, with regard to the accuracy of information contained in this book, nor
do they accept any liability for any loss or damage arising from any errors or
omissions.
This book contains trademarked terms that are used solely for editorial purposes
and to the benefit of the respective trademark owner. The terms used within this
book are not intended as infringement of any trademarks.
Rev: 1.0
Table of Contents
1.Introduction
1.1 Downloading the Code Samples
1.2 Feedback
1.3 Errata
2.Setting up an Android Studio Development Environment
2.1 System Requirements
2.2 Installing the Java Development Kit (JDK)
2.2.1 Windows JDK Installation
2.2.2 Mac OS X JDK Installation
2.3 Linux JDK Installation
2.4 Downloading the Android Studio Package
2.5 Installing Android Studio
2.5.1 Installation on Windows
2.5.2 Installation on Mac OS X
2.5.3 Installation on Linux
2.6 The Android Studio Setup Wizard
2.7 Installing Additional Android SDK Packages
2.8 Making the Android SDK Tools Command-line Accessible
2.8.1 Windows 7
2.8.2 Windows 8.1
2.8.3 Windows 10
2.8.4 Linux
2.8.5 Mac OS X
2.9 Updating the Android Studio and the SDK
2.10 Summary
3.Creating an Example Android App in Android Studio
3.1 Creating a New Android Project
3.2 Defining the Project and SDK Settings
3.3 Creating an Activity
3.4 Modifying the Example Application
3.5 Reviewing the Layout and Resource Files
3.6 Summary
4.A Tour of the Android Studio User Interface
4.1 The Welcome Screen
4.2 The Main Window
4.3 The Tool Windows
4.4 Android Studio Keyboard Shortcuts
4.5 Switcher and Recent Files Navigation
4.6 Changing the Android Studio Theme
4.7 Summary
5.Creating an Android Virtual Device (AVD) in Android Studio
5.1 About Android Virtual Devices
5.2 Creating a New AVD
5.3 Starting the Emulator
5.4 Running the Application in the AVD
5.5 Run/Debug Configurations
5.6 Stopping a Running Application
5.7 AVD Command-line Creation
5.8 Android Virtual Device Configuration Files
5.9 Moving and Renaming an Android Virtual Device
5.10 Summary
6. Using and Configuring the Android Studio AVD Emulator
6.1 The Emulator Environment
6.2 The Emulator Toolbar Options
6.3 Working in Zoom Mode
6.4 Resizing the Emulator Window
6.5 Extended Control Options
6.5.1 Location
6.5.2 Cellular
6.5.3 Battery
6.5.4 Phone
6.5.5 Directional Pad
6.5.6 Fingerprint
6.5.7 Virtual Sensors
6.5.8 Settings
6.5.9 Help
6.6 Drag and Drop Support
6.7 Configuring Fingerprint Emulation
6.8 Summary
7.Testing Android Studio Apps on a Physical Android Device
7.1 An Overview of the Android Debug Bridge (ADB)
7.2 Enabling ADB on Android based Devices
7.2.1 Mac OS X ADB Configuration
7.2.2 Windows ADB Configuration
7.2.3 Linux adb Configuration
7.3 Testing the adb Connection
7.4 Summary
8.The Basics of the Android Studio Code Editor
8.1 The Android Studio Editor
8.2 Splitting the Editor Window
8.3 Code Completion
8.4 Statement Completion
8.5 Parameter Information
8.6 Code Generation
8.7 Code Folding
8.8 Quick Documentation Lookup
8.9 Code Reformatting
8.10 Finding Sample Code
8.11 Summary
9.An Overview of the Android Architecture
9.1 The Android Software Stack
9.2 The Linux Kernel
9.3 Android Runtime – ART
9.4 Android Libraries
9.4.1 C/C++ Libraries
9.5 Application Framework
9.6 Applications
9.7 Summary
10.The Anatomy of an Android Application
10.1 Android Activities
10.2 Android Intents
10.3 Broadcast Intents
10.4 Broadcast Receivers
10.5 Android Services
10.6 Content Providers
10.7 The Application Manifest
10.8 Application Resources
10.9 Application Context
10.10 Summary
11.Understanding Android Application and Activity Lifecycles
11.1 Android Applications and Resource Management
11.2 Android Process States
11.2.1 Foreground Process
11.2.2 Visible Process
11.2.3 Service Process
11.2.4 Background Process
11.2.5 Empty Process
11.3 InterProcess Dependencies
11.4 The Activity Lifecycle
11.5 The Activity Stack
11.6 Activity States
11.7 Configuration Changes
11.8 Handling State Change
11.9 Summary
12.Handling Android Activity State Changes
12.1 The Activity Class
12.2 Dynamic State vs. Persistent State
12.3 The Android Activity Lifecycle Methods
12.4 Activity Lifetimes
12.5 Disabling Configuration Change Restarts
12.6 Summary
13.Android Activity State Changes by Example
13.1 Creating the State Change Example Project
13.2 Designing the User Interface
13.3 Overriding the Activity Lifecycle Methods
13.4 Filtering the LogCat Panel
13.5 Running the Application
13.6 Experimenting with the Activity
13.7 Summary
14.Saving and Restoring the State of an Android Activity
14.1 Saving Dynamic State
14.2 Default Saving of User Interface State
14.3 The Bundle Class
14.4 Saving the State
14.5 Restoring the State
14.6 Testing the Application
14.7 Summary
15.Understanding Android Views, View Groups and Layouts
15.1 Designing for Different Android Devices
15.2 Views and View Groups
15.3 Android Layout Managers
15.4 The View Hierarchy
15.5 Creating User Interfaces
15.6 Summary
16.A Guide to the Android Studio Layout Editor Tool
16.1 Basic vs. Empty Activity Templates
16.2 The Android Studio Layout Editor
16.3 Design Mode
16.4 The Palette
16.5 Pan and Zoom
16.6 Design and Layout Views
16.7 Text Mode
16.8 Setting Properties
16.9 Configuring Favorite Attributes
16.10 Creating a Custom Device Definition
16.11 Changing the Current Device
16.12 Summary
17.A Guide to the Android ConstraintLayout
17.1 How ConstraintLayout Works
17.1.1 Constraints
17.1.2 Margins
17.1.3 Opposing Constraints
17.1.4 Constraint Bias
17.1.5 Chains
17.1.6 Chain Styles
17.2 Baseline Alignment
17.3 Working with Guidelines
17.4 Configuring Widget Dimensions
17.5 Ratios
17.6 ConstraintLayout Advantages
17.7 ConstraintLayout Availability
17.8 Summary
18.A Guide to using ConstraintLayout in Android Studio
18.1 Design and Layout Views
18.2 Autoconnect Mode
18.3 Inference Mode
18.4 Manipulating Constraints Manually
18.5 Deleting Constraints
18.6 Adjusting Constraint Bias
18.7 Understanding ConstraintLayout Margins
18.8 The Importance of Opposing Constraints and Bias
18.9 Configuring Widget Dimensions
18.10 Adding Guidelines
18.11 Widget Group Alignment
18.12 Converting other Layouts to ConstraintLayout
18.13 Summary
19.Working with ConstraintLayout Chains and Ratios in Android Studio
19.1 Creating a Chain
19.2 Changing the Chain Style
19.3 Spread Inside Chain Style
19.4 Packed Chain Style
19.5 Packed Chain Style with Bias
19.6 Weighted Chain
19.7 Working with Ratios
19.8 Summary
20.An Android Studio Layout Editor ConstraintLayout Tutorial
20.1 An Android Studio Layout Editor Tool Example
20.2 Creating a New Activity
20.3 Preparing the Layout Editor Environment
20.4 Adding the Widgets to the User Interface
20.5 Adding the Constraints
20.6 Testing the Layout
20.7 Using the Layout Inspector
20.8 Using the Hierarchy Viewer
20.9 Summary
21.Manual XML Layout Design in Android Studio
21.1 Manually Creating an XML Layout
21.2 Manual XML vs. Visual Layout Design
21.3 Summary
22.Managing Constraints using Constraint Sets
22.1 Java Code vs. XML Layout Files
22.2 Creating Views
22.3 View Properties
22.4 Constraint Sets
22.4.1 Establishing Connections
22.4.2 Applying Constraints to a Layout
22.4.3 Parent Constraint Connections
22.4.4 Sizing Constraints
22.4.5 Constraint Bias
22.4.6 Alignment Constraints
22.4.7 Copying and Applying Constraint Sets
22.4.8 ConstraintLayout Chains
22.4.9 Guidelines
22.4.10 Removing Constraints
22.4.11 Scaling
22.4.12 Rotation
22.5 Summary
23.An Android ConstraintSet Tutorial
23.1 Creating the Example Project in Android Studio
23.2 Adding Views to an Activity
23.3 Setting View Properties
23.4 Creating View IDs
23.5 Configuring the Constraint Set
23.6 Adding the EditText View
23.7 Converting Density Independent Pixels (dp) to Pixels (px)
23.8 Summary
24.An Overview and Example of Android Event Handling
24.1 Understanding Android Events
24.2 Using the android:onClick Resource
24.3 Event Listeners and Callback Methods
24.4 An Event Handling Example
24.5 Designing the User Interface
24.6 The Event Listener and Callback Method
24.7 Consuming Events
24.8 Summary
25. A Guide to using Instant Run in Android Studio
25.1 Introducing Instant Run
25.2 Understanding Instant Run Swapping Levels
25.3 Enabling and Disabling Instant Run
25.4 Using Instant Run
25.5 An Instant Run Tutorial
25.6 Triggering an Instant Run Hot Swap
25.7 Triggering an Instant Run Warm Swap
25.8 Triggering an Instant Run Cold Swap
25.9 The Run Button
25.10 Summary
26.Android Touch and Multi-touch Event Handling
26.1 Intercepting Touch Events
26.2 The MotionEvent Object
26.3 Understanding Touch Actions
26.4 Handling Multiple Touches
26.5 An Example Multi-Touch Application
26.6 Designing the Activity User Interface
26.7 Implementing the Touch Event Listener
26.8 Running the Example Application
26.9 Summary
27.Detecting Common Gestures using the Android Gesture Detector Class
27.1 Implementing Common Gesture Detection
27.2 Creating an Example Gesture Detection Project
27.3 Implementing the Listener Class
27.4 Creating the GestureDetectorCompat Instance
27.5 Implementing the onTouchEvent() Method
27.6 Testing the Application
27.7 Summary
28.Implementing Custom Gesture and Pinch Recognition on Android
28.1 The Android Gesture Builder Application
28.2 The GestureOverlayView Class
28.3 Detecting Gestures
28.4 Identifying Specific Gestures
28.5 Building and Running the Gesture Builder Application
28.6 Creating a Gestures File
28.7 Extracting the Gestures File from the SD Card
28.8 Creating the Example Project
28.9 Adding the Gestures File to the Project
28.10 Designing the User Interface
28.11 Loading the Gestures File
28.12 Registering the Event Listener
28.13 Implementing the onGesturePerformed Method
28.14 Testing the Application
28.15 Configuring the GestureOverlayView
28.16 Intercepting Gestures
28.17 Detecting Pinch Gestures
28.18 A Pinch Gesture Example Project
28.19 Summary
29.An Introduction to Android Fragments
29.1 What is a Fragment?
29.2 Creating a Fragment
29.3 Adding a Fragment to an Activity using the Layout XML File
29.4 Adding and Managing Fragments in Code
29.5 Handling Fragment Events
29.6 Implementing Fragment Communication
29.7 Summary
30.Using Fragments in Android Studio - An Example
30.1 About the Example Fragment Application
30.2 Creating the Example Project
30.3 Creating the First Fragment Layout
30.4 Creating the First Fragment Class
30.5 Creating the Second Fragment Layout
30.6 Adding the Fragments to the Activity
30.7 Making the Toolbar Fragment Talk to the Activity
30.8 Making the Activity Talk to the Text Fragment
30.9 Testing the Application
30.10 Summary
31.Creating and Managing Overflow Menus on Android
31.1 The Overflow Menu
31.2 Creating an Overflow Menu
31.3 Displaying an Overflow Menu
31.4 Responding to Menu Item Selections
31.5 Creating Checkable Item Groups
31.6 Menus and the Android Studio Menu Editor
31.7 Creating the Example Project
31.8 Designing the Menu
31.9 Modifying the onOptionsItemSelected() Method
31.10 Testing the Application
31.11 Summary
32.Animating User Interfaces with the Android Transitions Framework
32.1 Introducing Android Transitions and Scenes
32.2 Using Interpolators with Transitions
32.3 Working with Scene Transitions
32.4 Custom Transitions and TransitionSets in Code
32.5 Custom Transitions and TransitionSets in XML
32.6 Working with Interpolators
32.7 Creating a Custom Interpolator
32.8 Using the beginDelayedTransition Method
32.9 Summary
33.An Android Transition Tutorial using beginDelayedTransition
33.1 Creating the Android Studio TransitionDemo Project
33.2 Preparing the Project Files
33.3 Implementing beginDelayedTransition Animation
33.4 Customizing the Transition
33.5 Summary
34.Implementing Android Scene Transitions – A Tutorial
34.1 An Overview of the Scene Transition Project
34.2 Creating the Android Studio SceneTransitions Project
34.3 Identifying and Preparing the Root Container
34.4 Designing the First Scene
34.5 Designing the Second Scene
34.6 Entering the First Scene
34.7 Loading Scene 2
34.8 Implementing the Transitions
34.9 Adding the Transition File
34.10 Loading and Using the Transition Set
34.11 Configuring Additional Transitions
34.12 Summary
35.Working with the Floating Action Button and Snackbar
35.1 The Material Design
35.2 The Design Library
35.3 The Floating Action Button (FAB)
35.4 The Snackbar
35.5 Creating the Example Project
35.6 Reviewing the Project
35.7 Changing the Floating Action Button
35.8 Adding the ListView to the Content Layout
35.9 Adding Items to the ListView
35.10 Adding an Action to the Snackbar
35.11 Summary
36.Creating a Tabbed Interface using the TabLayout Component
36.1 An Introduction to the ViewPager
36.2 An Overview of the TabLayout Component
36.3 Creating the TabLayoutDemo Project
36.4 Creating the First Fragment
36.5 Duplicating the Fragments
36.6 Adding the TabLayout and ViewPager
36.7 Creating the Pager Adapter
36.8 Performing the Initialization Tasks
36.9 Testing the Application
36.10 Customizing the TabLayout
36.11 Displaying Icon Tab Items
36.12 Summary
37.Working with the RecyclerView and CardView Widgets
37.1 An Overview of the RecyclerView
37.2 An Overview of the CardView
37.3 Adding the Libraries to the Project
37.4 Summary
38.An Android RecyclerView and CardView Tutorial
38.1 Creating the CardDemo Project
38.2 Removing the Floating Action Button
38.3 Adding the RecyclerView and CardView Libraries
38.4 Designing the CardView Layout
38.5 Adding the RecyclerView
38.6 Creating the RecyclerView Adapter
38.7 Adding the Image Files
38.8 Initializing the RecyclerView Component
38.9 Testing the Application
38.10 Responding to Card Selections
38.11 Summary
39.Working with the AppBar and Collapsing Toolbar Layouts
39.1 The Anatomy of an AppBar
39.2 The Example Project
39.3 Coordinating the RecyclerView and Toolbar
39.4 Introducing the Collapsing Toolbar Layout
39.5 Changing the Title and Scrim Color
39.6 Summary
40.Implementing an Android Navigation Drawer
40.1 An Overview of the Navigation Drawer
40.2 Opening and Closing the Drawer
40.3 Responding to Drawer Item Selections
40.4 Using the Navigation Drawer Activity Template
40.5 Creating the Navigation Drawer Template Project
40.6 The Template Layout Resource Files
40.7 The Header Coloring Resource File
40.8 The Template Menu Resource File
40.9 The Template Code
40.10 Running the App
40.11 Summary
41.An Android Studio Master/Detail Flow Tutorial
41.1 The Master/Detail Flow
41.2 Creating a Master/Detail Flow Activity
41.3 The Anatomy of the Master/Detail Flow Template
41.4 Modifying the Master/Detail Flow Template
41.5 Changing the Content Model
41.6 Changing the Detail Pane
41.7 Modifying the WebsiteDetailFragment Class
41.8 Modifying the WebsiteListActivity Class
41.9 Adding Manifest Permissions
41.10 Running the Application
41.11 Summary
42.An Overview of Android Intents
42.1 An Overview of Intents
42.2 Explicit Intents
42.3 Returning Data from an Activity
42.4 Implicit Intents
42.5 Using Intent Filters
42.6 Checking Intent Availability
42.7 Summary
43.Android Explicit Intents – A Worked Example
43.1 Creating the Explicit Intent Example Application
43.2 Designing the User Interface Layout for ActivityA
43.3 Creating the Second Activity Class
43.4 Designing the User Interface Layout for ActivityB
43.5 Reviewing the Application Manifest File
43.6 Creating the Intent
43.7 Extracting Intent Data
43.8 Launching ActivityB as a Sub-Activity
43.9 Returning Data from a Sub-Activity
43.10 Testing the Application
43.11 Summary
44.Android Implicit Intents – A Worked Example
44.1 Creating the Android Studio Implicit Intent Example Project
44.2 Designing the User Interface
44.3 Creating the Implicit Intent
44.4 Adding a Second Matching Activity
44.5 Adding the Web View to the UI
44.6 Obtaining the Intent URL
44.7 Modifying the MyWebView Project Manifest File
44.8 Installing the MyWebView Package on a Device
44.9 Testing the Application
44.10 Summary
45.Android Broadcast Intents and Broadcast Receivers
45.1 An Overview of Broadcast Intents
45.2 An Overview of Broadcast Receivers
45.3 Obtaining Results from a Broadcast
45.4 Sticky Broadcast Intents
45.5 The Broadcast Intent Example
45.6 Creating the Example Application
45.7 Creating and Sending the Broadcast Intent
45.8 Creating the Broadcast Receiver
45.9 Configuring a Broadcast Receiver in the Manifest File
45.10 Testing the Broadcast Example
45.11 Listening for System Broadcasts
45.12 Summary
46.A Basic Overview of Threads and Thread Handlers
46.1 An Overview of Threads
46.2 The Application Main Thread
46.3 Thread Handlers
46.4 A Basic Threading Example
46.5 Creating a New Thread
46.6 Implementing a Thread Handler
46.7 Passing a Message to the Handler
46.8 Summary
47.An Overview of Android Started and Bound Services
47.1 Started Services
47.2 Intent Service
47.3 Bound Service
47.4 The Anatomy of a Service
47.5 Controlling Destroyed Service Restart Options
47.6 Declaring a Service in the Manifest File
47.7 Starting a Service Running on System Startup
47.8 Summary
48.Implementing an Android Started Service – A Worked Example
48.1 Creating the Example Project
48.2 Creating the Service Class
48.3 Adding the Service to the Manifest File
48.4 Starting the Service
48.5 Testing the IntentService Example
48.6 Using the Service Class
48.7 Creating the New Service
48.8 Modifying the User Interface
48.9 Running the Application
48.10 Creating a New Thread for Service Tasks
48.11 Summary
49.Android Local Bound Services – A Worked Example
49.1 Understanding Bound Services
49.2 Bound Service Interaction Options
49.3 An Android Studio Local Bound Service Example
49.4 Adding a Bound Service to the Project
49.5 Implementing the Binder
49.6 Binding the Client to the Service
49.7 Completing the Example
49.8 Testing the Application
49.9 Summary
50.Android Remote Bound Services – A Worked Example
50.1 Client to Remote Service Communication
50.2 Creating the Example Application
50.3 Designing the User Interface
50.4 Implementing the Remote Bound Service
50.5 Configuring a Remote Service in the Manifest File
50.6 Launching and Binding to the Remote Service
50.7 Sending a Message to the Remote Service
50.8 Summary
51.An Android 7 Notifications Tutorial
51.1 An Overview of Notifications
51.2 Creating the NotifyDemo Project
51.3 Designing the User Interface
51.4 Creating the Second Activity
51.5 Creating and Issuing a Basic Notification
51.6 Launching an Activity from a Notification
51.7 Adding Actions to a Notification
51.8 Adding Sound to a Notification
51.9 Bundled Notifications
51.10 Summary
52.An Android 7 Direct Reply Notification Tutorial
52.1 Creating the DirectReply Project
52.2 Designing the User Interface
52.3 Building the RemoteInput Object
52.4 Creating the PendingIntent
52.5 Creating the Reply Action
52.6 Receiving Direct Reply Input
52.7 Updating the Notification
52.8 Summary
53.Integrating Firebase Support into an Android Studio Project
53.1 What is Firebase?
53.2 Signing in to Firebase
53.3 Creating the FirebaseNotify Project
53.4 Configuring the User Interface
53.5 Connecting the Project to Firebase
53.6 Creating a New Firebase Project
53.7 The google-services.json File
53.8 Adding the Firebase Libraries
53.9 Summary
54.An Android 7 Firebase Remote Notification Tutorial
54.1 Sending a Firebase Notification
54.2 Receiving the Notification
54.3 Including Custom Data within the Notification
54.4 Foreground App Notification Handling
54.5 Summary
55.An Introduction to Android 7 MultiWindow Support
55.1 Split-Screen, Freeform and Picture-in-Picture Modes
55.2 Entering MultiWindow Mode
55.3 Checking for Freeform Support
55.4 Enabling MultiWindow Support in an App
55.5 Specifying MultiWindow Attributes
55.6 Detecting MultiWindow Mode in an Activity
55.7 Receiving MultiWindow Notifications
55.8 Launching an Activity in MultiWindow Mode
55.9 Configuring Freeform Activity Size and Position
55.10 Summary
56.An Android Studio MultiWindow Split-Screen and Freeform Tutorial
56.1 Creating the MultiWindow Project
56.2 Designing the FirstActivity User Interface
56.3 Adding the Second Activity
56.4 Launching the Second Activity
56.5 Enabling MultiWindow Mode
56.6 Testing MultiWindow Support
56.7 Launching the Second Activity in a Different Window
56.8 Changing the Freeform Window Position and Size
56.9 Summary
57.An Overview of Android SQLite Databases
57.1 Understanding Database Tables
57.2 Introducing Database Schema
57.3 Columns and Data Types
57.4 Database Rows
57.5 Introducing Primary Keys
57.6 What is SQLite?
57.7 Structured Query Language (SQL)
57.8 Trying SQLite on an Android Virtual Device (AVD)
57.9 Android SQLite Java Classes
57.9.1 Cursor
57.9.2 SQLiteDatabase
57.9.3 SQLiteOpenHelper
57.9.4 ContentValues
57.10 Summary
58.An Android TableLayout and TableRow Tutorial
58.1 The TableLayout and TableRow Layout Views
58.2 Creating the Database Project
58.3 Adding the TableLayout to the User Interface
58.4 Configuring the TableRows
58.5 Adding the Button Bar to the Layout
58.6 Adjusting the Layout Margins
58.7 Summary
59.An Android SQLite Database Tutorial
59.1 About the Database Example
59.2 Creating the Data Model
59.3 Implementing the Data Handler
59.3.1 The Add Handler Method
59.3.2 The Query Handler Method
59.3.3 The Delete Handler Method
59.4 Implementing the Activity Event Methods
59.5 Testing the Application
59.6 Summary
60.Understanding Android Content Providers
60.1 What is a Content Provider?
60.2 The Content Provider
60.2.1 onCreate()
60.2.2 query()
60.2.3 insert()
60.2.4 update()
60.2.5 delete()
60.2.6 getType()
60.3 The Content URI
60.4 The Content Resolver
60.5 The <provider> Manifest Element
60.6 Summary
61.Implementing an Android Content Provider in Android Studio
61.1 Copying the Database Project
61.2 Adding the Content Provider Package
61.3 Creating the Content Provider Class
61.4 Constructing the Authority and Content URI
61.5 Implementing URI Matching in the Content Provider
61.6 Implementing the Content Provider onCreate() Method
61.7 Implementing the Content Provider insert() Method
61.8 Implementing the Content Provider query() Method
61.9 Implementing the Content Provider update() Method
61.10 Implementing the Content Provider delete() Method
61.11 Declaring the Content Provider in the Manifest File
61.12 Modifying the Database Handler
61.13 Summary
62.Accessing Cloud Storage using the Android Storage Access Framework
62.1 The Storage Access Framework
62.2 Working with the Storage Access Framework
62.3 Filtering Picker File Listings
62.4 Handling Intent Results
62.5 Reading the Content of a File
62.6 Writing Content to a File
62.7 Deleting a File
62.8 Gaining Persistent Access to a File
62.9 Summary
63.An Android Storage Access Framework Example
63.1 About the Storage Access Framework Example
63.2 Creating the Storage Access Framework Example
63.3 Designing the User Interface
63.4 Declaring Request Codes
63.5 Creating a New Storage File
63.6 The onActivityResult() Method
63.7 Saving to a Storage File
63.8 Opening and Reading a Storage File
63.9 Testing the Storage Access Application
63.10 Summary
64.Implementing Video Playback on Android using the VideoView and
MediaController Classes
64.1 Introducing the Android VideoView Class
64.2 Introducing the Android MediaController Class
64.3 Testing Video Playback
64.4 Creating the Video Playback Example
64.5 Designing the VideoPlayer Layout
64.6 Configuring the VideoView
64.7 Adding Internet Permission
64.8 Adding the MediaController to the Video View
64.9 Setting up the onPreparedListener
64.10 Summary
65.Video Recording and Image Capture on Android using Camera Intents
65.1 Checking for Camera Support
65.2 Calling the Video Capture Intent
65.3 Calling the Image Capture Intent
65.4 Creating an Android Studio Video Recording Project
65.5 Designing the User Interface Layout
65.6 Checking for the Camera
65.7 Launching the Video Capture Intent
65.8 Handling the Intent Return
65.9 Testing the Application
65.10 Summary
66.Making Runtime Permission Requests in Android
66.1 Understanding Normal and Dangerous Permissions
66.2 Creating the Permissions Example Project
66.3 Checking for a Permission
66.4 Requesting Permission at Runtime
66.5 Providing a Rationale for the Permission Request
66.6 Testing the Permissions App
66.7 Summary
67.Android Audio Recording and Playback using MediaPlayer and
MediaRecorder
67.1 Playing Audio
67.2 Recording Audio and Video using the MediaRecorder Class
67.3 About the Example Project
67.4 Creating the AudioApp Project
67.5 Designing the User Interface
67.6 Checking for Microphone Availability
67.7 Performing the Activity Initialization
67.8 Implementing the recordAudio() Method
67.9 Implementing the stopAudio() Method
67.10 Implementing the playAudio() method
67.11 Configuring and Requesting Permissions
67.12 Testing the Application
67.13 Summary
68.Working with the Google Maps Android API in Android Studio
68.1 The Elements of the Google Maps Android API
68.2 Creating the Google Maps Project
68.3 Obtaining Your Developer Signature
68.4 Testing the Application
68.5 Understanding Geocoding and Reverse Geocoding
68.6 Adding a Map to an Application
68.7 Requesting Current Location Permission
68.8 Displaying the User’s Current Location
68.9 Changing the Map Type
68.10 Displaying Map Controls to the User
68.11 Handling Map Gesture Interaction
68.11.1 Map Zooming Gestures
68.11.2 Map Scrolling/Panning Gestures
68.11.3 Map Tilt Gestures
68.11.4 Map Rotation Gestures
68.12 Creating Map Markers
68.13 Controlling the Map Camera
68.14 Summary
69.Printing with the Android Printing Framework
69.1 The Android Printing Architecture
69.2 The Print Service Plugins
69.3 Google Cloud Print
69.4 Printing to Google Drive
69.5 Save as PDF
69.6 Printing from Android Devices
69.7 Options for Building Print Support into Android Apps
69.7.1 Image Printing
69.7.2 Creating and Printing HTML Content
69.7.3 Printing a Web Page
69.7.4 Printing a Custom Document
69.8 Summary
70.An Android HTML and Web Content Printing Example
70.1 Creating the HTML Printing Example Application
70.2 Printing Dynamic HTML Content
70.3 Creating the Web Page Printing Example
70.4 Removing the Floating Action Button
70.5 Designing the User Interface Layout
70.6 Loading the Web Page into the WebView
70.7 Adding the Print Menu Option
70.8 Summary
71.A Guide to Android Custom Document Printing
71.1 An Overview of Android Custom Document Printing
71.1.1 Custom Print Adapters
71.2 Preparing the Custom Document Printing Project
71.3 Creating the Custom Print Adapter
71.4 Implementing the onLayout() Callback Method
71.5 Implementing the onWrite() Callback Method
71.6 Checking a Page is in Range
71.7 Drawing the Content on the Page Canvas
71.8 Starting the Print Job
71.9 Testing the Application
71.10 Summary
72.An Android Fingerprint Authentication Tutorial
72.1 An Overview of Fingerprint Authentication
72.2 Creating the Fingerprint Authentication Project
72.3 Configuring Device Fingerprint Authentication
72.4 Adding the Fingerprint Permission to the Manifest File
72.5 Adding the Fingerprint Icon
72.6 Designing the User Interface
72.7 Accessing the Keyguard and Fingerprint Manager Services
72.8 Checking the Security Settings
72.9 Accessing the Android Keystore and KeyGenerator
72.10 Generating the Key
72.11 Initializing the Cipher
72.12 Creating the CryptoObject Instance
72.13 Implementing the Fingerprint Authentication Handler Class
72.14 Testing the Project
72.15 Summary
73.Handling Different Android Devices and Displays
73.1 Handling Different Device Displays
73.2 Creating a Layout for each Display Size
73.3 Creating Layout Variants in Android Studio
73.4 Providing Different Images
73.5 Checking for Hardware Support
73.6 Providing Device Specific Application Binaries
73.7 Summary
74.Signing and Preparing an Android Application for Release
74.1 The Release Preparation Process
74.2 Changing the Build Variant
74.3 Enabling ProGuard
74.4 Creating a Keystore File
74.5 Generating a Private Key
74.6 Creating the Application APK File
74.7 Register for a Google Play Developer Console Account
74.8 Uploading New APK Versions to the Google Play Developer Console
74.9 Analyzing the APK File
74.10 Summary
75. Integrating Google Play In-app Billing into an Android Application
75.1 Installing the Google Play Billing Library
75.2 Creating the Example In-app Billing Project
75.3 Adding Billing Permission to the Manifest File
75.4 Adding the IInAppBillingService.aidl File to the Project
75.5 Adding the Utility Classes to the Project
75.6 Designing the User Interface
75.7 Implementing the “Click Me” Button
75.8 Google Play Developer Console and Google Wallet Accounts
75.9 Obtaining the Public License Key for the Application
75.10 Setting Up Google Play Billing in the Application
75.11 Initiating a Google Play In-app Billing Purchase
75.12 Implementing the onActivityResult Method
75.13 Implementing the Purchase Finished Listener
75.14 Consuming the Purchased Item
75.15 Releasing the IabHelper Instance
75.16 Modifying the Security.java File
75.17 Testing the In-app Billing Application
75.18 Building a Release APK
75.19 Creating a New In-app Product
75.20 Publishing the Application to the Alpha Distribution Channel
75.21 Adding In-app Billing Test Accounts
75.22 Configuring Group Testing
75.23 Resolving Problems with In-App Purchasing
75.24 Summary
76. An Overview of Gradle in Android Studio
76.1 An Overview of Gradle
76.2 Gradle and Android Studio
76.2.1 Sensible Defaults
76.2.2 Dependencies
76.2.3 Build Variants
76.2.4 Manifest Entries
76.2.5 APK Signing
76.2.6 ProGuard Support
76.3 The Top-level Gradle Build File
76.4 Module Level Gradle Build Files
76.5 Configuring Signing Settings in the Build File
76.6 Running Gradle Tasks from the Command-line
76.7 Summary
77. An Android Studio Gradle Build Variants Example
77.1 Creating the Build Variant Example Project
77.2 Adding the Build Flavors to the Module Build File
77.3 Adding the Flavors to the Project Structure
77.4 Adding Resource Files to the Flavors
77.5 Testing the Build Flavors
77.6 Build Variants and Class Files
77.7 Adding Packages to the Build Flavors
77.8 Customizing the Activity Classes
77.9 Summary
1. Introduction
Fully updated for Android Studio 2.3 and Android 7, the goal of this book is to
teach the skills necessary to develop Android based applications using the
Android Studio Integrated Development Environment (IDE) and the Android 7
Software Development Kit (SDK).
Beginning with the basics, this book provides an outline of the steps necessary to
set up an Android development and testing environment. An overview of
Android Studio is included covering areas such as tool windows, the code editor
and the Layout Editor tool. An introduction to the architecture of Android is
followed by an in-depth look at the design of Android applications and user
interfaces using the Android Studio environment. More advanced topics such as
database management, content providers and intents are also covered, as are
touch screen handling, gesture recognition, camera access and the playback and
recording of both video and audio. This edition of the book also covers printing,
transitions and cloud-based file storage.
The concepts of material design are also covered in detail, including the use of
floating action buttons, Snackbars, tabbed interfaces, card views, navigation
drawers and collapsing toolbars.
In addition to covering general Android development techniques, the book also
includes Google Play specific topics such as implementing maps using the
Google Maps Android API, in-app billing and submitting apps to the Google
Play Developer Console.
The key new features of Android Studio and Android 7 are also covered in detail
including the new Layout Editor, the ConstraintLayout and ConstraintSet
classes, constraint chains, direct reply notifications, Firebase remote
notifications and multiwindow support.
Chapters also cover advanced features of Android Studio such as Gradle build
configuration and the implementation of build variants to target multiple
Android device types from a single project code base.
Assuming you already have some Java programming experience, are ready to
download Android Studio and the Android SDK, have access to a Windows,
Mac or Linux system and ideas for some apps to develop, you are ready to get
started.
1.1 Downloading the Code Samples
The source code and Android Studio project files for the examples contained in
this book are available for download at:
http://www.ebookfrenzy.com/retail/androidstudio23/index.php
The steps to load a project from the code samples into Android Studio are as
follows:
1. From the Welcome to Android Studio dialog, select the Open an existing
Android Studio project option.
2. In the project selection dialog, navigate to and select the folder containing
the project to be imported and click on OK.
1.2 Feedback
We want you to be satisfied with your purchase of this book. If you find any
errors in the book, or have any comments, questions or concerns please contact
us at [email protected].
1.3 Errata
While we make every effort to ensure the accuracy of the content of this book, it
is inevitable that a book covering a subject area of this size and complexity may
include some errors and oversights. Any known issues with the book will be
outlined, together with solutions, at the following URL:
http://www.ebookfrenzy.com/errata/androidstudio23.html
In the event that you find an error not listed in the errata, please let us know by
emailing our technical support team at [email protected]. They are
there to help you and will work to resolve any problems you may encounter.
2. Setting up an Android Studio Development
Environment
Before any work can begin on the development of an Android application, the
first step is to configure a computer system to act as the development platform.
This involves a number of steps consisting of installing the Java Development
Kit (JDK) and the Android Studio Integrated Development Environment (IDE)
which also includes the Android Software Development Kit (SDK).
This chapter will cover the steps necessary to install the requisite components for
Android application development on Windows, Mac OS X and Linux based
systems.
2.1 System Requirements
Android application development may be performed on any of the following
system types:
· Windows 7/8/10 (32-bit or 64-bit)
· Mac OS X 10.10 or later (Intel based systems only)
· Linux systems with version 2.19 or later of GNU C Library (glibc)
· Minimum of 2GB of RAM (8GB is preferred)
· Approximately 4GB of available disk space
· 1280 x 800 minimum screen resolution

2.2 Installing the Java Development Kit (JDK)


The Android SDK was developed using the Java programming language.
Similarly, Android applications are also developed using Java. As a result, the
Java Development Kit (JDK) is the first component that must be installed.
Android Studio development requires the installation of version 8 of the
Standard Edition of the Java Platform Development Kit. Java is provided in both
development (JDK) and runtime (JRE) packages. For the purposes of Android
development, the JDK must be installed.
2.2.1 Windows JDK Installation
For Windows systems, the JDK may be obtained from Oracle Corporation’s
website using the following URL:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-
2133151.html
Assuming that a suitable JDK is not already installed on your system, download
version 8 of the JDK package that matches the destination computer system.
Once downloaded, launch the installation executable and follow the on screen
instructions to complete the installation process.
2.2.2 Mac OS X JDK Installation
Java is not installed by default on recent versions of Mac OS X. To confirm the
presence or otherwise of Java, open a Terminal window and enter the following
command:
java -version

Assuming that Java is currently installed, output similar to the following will
appear in the terminal window:
java version "1.8.0_77"
Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
Java HotSpot(TM) 64-Bit Server VM (build 25.77-b03, mixed mode)

In the event that Java is not installed, issuing the “java” command in the terminal
window will result in the appearance of a message which reads as follows
together with a dialog on the desktop providing a More Info button which, when
clicked will display the Oracle Java web page:
No Java runtime present, requesting install

On the Oracle Java web page, locate and download the Java SE 8 JDK
installation package for Mac OS X.
Open the downloaded disk image (.dmg file) and double-click on the icon to
install the Java package (Figure 2-1):
Figure 2-1
The Java for OS X installer window will appear and take you through the steps
involved in installing the JDK. Once the installation is complete, return to the
Terminal window and run the following command, at which point the previously
outlined Java version information should appear:
java -version

2.3 Linux JDK Installation


First, if the chosen development system is running the 64-bit version of Ubuntu
then it is essential that a 32-bit library support package be installed:
sudo apt-get install lib32stdc++6

As with Windows based JDK installation, it is possible to install the JDK on


Linux by downloading the appropriate package from the Oracle web site, the
URL for which is as follows:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-
2133151.html
Packages are provided by Oracle in RPM format (for installation on Red Hat
Linux based systems such as Red Hat Enterprise Linux, Fedora and CentOS) and
as a tar archive for other Linux distributions such as Ubuntu.
On Red Hat based Linux systems, download the .rpm JDK file from the Oracle
web site and perform the installation using the rpm command in a terminal
window. Assuming, for example, that the downloaded JDK file was named jdk-
8u77-linux-x64.rpm, the commands to perform the installation would read as
follows:
su
rpm –ihv jdk-8u77-linux-x64.rpm

To install using the compressed tar package (tar.gz) perform the following steps:
1. Create the directory into which the JDK is to be installed (for the purposes of
this example we will assume homedemo/java).
2. Download the appropriate tar.gz package from the Oracle web site into the
directory.
3. Execute the following command (where <jdk-file> is replaced by the name of
the downloaded JDK file):
tar xvfz <jdk-file>.tar.gz

4. Remove the downloaded tar.gz file.


5. Add the path to the bin directory of the JDK installation to your $PATH
variable. For example, assuming that the JDK ultimately installed into
homedemo/java/jdk1.8.0_77 the following would need to be added to your
$PATH environment variable:
homedemo/java/jdk1.8.0_77/bin

This can typically be achieved by adding a command to the .bashrc file in your
home directory (specifics may differ depending on the particular Linux
distribution in use). For example, change directory to your home directory, edit
the .bashrc file contained therein and add the following line at the end of the file
(modifying the path to match the location of the JDK on your system):
export PATH=homedemo/java/jdk1.8.0_77/bin:$PATH

Having saved the change, future terminal sessions will include the JDK in the
$PATH environment variable.
2.4 Downloading the Android Studio Package
Most of the work involved in developing applications for Android will be
performed using the Android Studio environment. The content and examples in
this book were created based on Android Studio version 2.3.
Android Studio is subject to frequent updates and it is possible, therefore, that a
more recent release of Android Studio is now available. For the purposes of
compatibility with the tutorials and examples, however, it is recommended that
this book be used with Android Studio version 2.3 which may be downloaded
from the following web page:
http://tools.android.com/download/studio/builds/2-3-0
From this page, select and download the appropriate package for your platform
and operating system.
2.5 Installing Android Studio
Once downloaded, the exact steps to install Android Studio differ depending on
the operating system on which the installation is being performed.
2.5.1 Installation on Windows
Locate the downloaded Android Studio installation executable file (named
androidstudio-bundle-<version>.exe) in a Windows Explorer window and
double-click on it to start the installation process, clicking the Yes button in the
User Account Control dialog if it appears.
Once the Android Studio setup wizard appears, work through the various screens
to configure the installation to meet your requirements in terms of the file system
location into which Android Studio should be installed and whether or not it
should be made available to other users of the system. When prompted to select
the components to install, make sure that the Android Studio, Android SDK and
Android Virtual Device options are all selected.
Although there are no strict rules on where Android Studio should be installed
on the system, the remainder of this book will assume that the installation was
performed into C:\Program Files\Android\Android Studio and that the Android
SDK packages have been installed into the user’s AppData\Local\Android\sdk
subfolder. Once the options have been configured, click on the Install button to
begin the installation process.
On versions of Windows with a Start menu, the newly installed Android Studio
can be launched from the entry added to that menu during the installation. The
executable may be pinned to the task bar for easy access by navigating to the
Android Studio\bin directory, right-clicking on the executable and selecting the
Pin to Taskbar menu option. Note that the executable is provided in 32-bit
(studio) and 64-bit (studio64) executable versions. If you are running a 32-bit
system be sure to use the studio executable.
2.5.2 Installation on Mac OS X
Android Studio for Mac OS X is downloaded in the form of a disk image (.dmg)
file. Once the androidstudio-ide-<version>.dmg file has been downloaded,
locate it in a Finder window and double-click on it to open it as shown in Figure
2-2:

Figure 2-2

To install the package, simply drag the Android Studio icon and drop it onto the
Applications folder. The Android Studio package will then be installed into the
Applications folder of the system, a process which will typically take a few
minutes to complete.
To launch Android Studio, locate the executable in the Applications folder using
a Finder window and double-click on it. When attempting to launch Android
Studio, an error dialog may appear indicating that the JVM cannot be found. If
this error occurs, it will be necessary to download and install the Mac OS X Java
6 JRE package on the system. This can be downloaded from Apple using the
following link:
http://support.apple.com/kb/DL1572
Once the Java for OS X package has been installed, Android Studio should
launch without any problems.
For future easier access to the tool, drag the Android Studio icon from the Finder
window and drop it onto the dock.
2.5.3 Installation on Linux
Having downloaded the Linux Android Studio package, open a terminal
window, change directory to the location where Android Studio is to be installed
and execute the following command:
unzip <path to package>androidstudio-ide-<version>-linux.zip

Note that the Android Studio bundle will be installed into a subdirectory named
androidstudio. Assuming, therefore, that the above command was executed in
homedemo, the software packages will be unpacked into
homedemo/androidstudio.
To launch Android Studio, open a terminal window, change directory to the
androidstudio/bin subdirectory and execute the following command:
./studio.sh

On Linux it may also be necessary to specify the location of the Java


Development Kit using the following steps:
1. Launch Android Studio and create a new project.
2. Select the File -> Other Settings -> Default Project Structure… menu
option.
3. Enter the full path to the directory containing the JDK into the JDK Location
field.
4. Click Apply followed by OK.

2.6 The Android Studio Setup Wizard


The first time that Android Studio is launched after being installed, a dialog will
appear providing the option to import settings from a previous Android Studio
version. If you have settings from a previous version and would like to import
them into the latest installation, select the appropriate option and location.
Alternatively, indicate that you do not need to import any previous settings and
click on the OK button to proceed.
Next, the setup wizard may appear as shown in Figure 2-3 though this dialog
does not appear on all platforms:
Figure 2-3
If the wizard appears, click on the Next button, choose the Standard installation
option and click on Next once again.
Android Studio will proceed to download and configure the latest Android SDK
and some additional components and packages. Once this process has
completed, click on the Finish button in the Downloading Components dialog at
which point the Welcome to Android Studio screen should then appear:
Figure 2-4

2.7 Installing Additional Android SDK Packages


The steps performed so far have installed Java, the Android Studio IDE and the
current set of default Android SDK packages. Before proceeding, it is worth
taking some time to verify which packages are installed and to install any
missing or updated packages.
This task can be performed using the Android SDK Settings screen, which may
be launched from within the Android Studio tool by selecting the Configure ->
SDK Manager option from within the Android Studio welcome dialog. Once
invoked, the Android SDK screen of the default settings dialog will appear as
shown in Figure 2-5:
Figure 2-5

Immediately after installing Android Studio for the first time it is likely that only
the latest released version of the Android SDK has been installed. To install
preview or older versions of the Android SDK simply select the checkboxes
corresponding to the versions and click on the Apply button.
It is also possible that updates will be listed as being available for the latest
SDK. To access detailed information about the packages that are available for
update, enable the Show Package Details option located in the lower right-hand
corner of the screen. This will display information similar to that shown in
Figure 2-6:
Figure 2-6
The above figure highlights the availability of an update. To install the updates,
enable the checkbox to the left of the item name and click on the Apply button.
In addition to the Android SDK packages, a number of tools are also installed
for building Android applications. To view the currently installed packages and
check for updates, remain within the SDK settings screen and select the SDK
Tools tab as shown in Figure 2-7:
Figure 2-7

Within the Android SDK Tools screen, make sure that the following packages
are listed as Installed in the Status column:
· Android SDK Build-tools
· Android SDK Tools
· Android SDK Platform-tools
· Android Support Repository
· Android Support Library
· Google Repository
· Google USB Driver (Windows only)
· Intel x86 Emulator Accelerator (HAXM installer)
In the event that any of the above packages are listed as Not Installed or
requiring an update, simply select the checkboxes next to those packages and
click on the Apply button to initiate the installation process.
Once the installation is complete, review the package list and make sure that the
selected packages are now listed as Installed in the Status column. If any are
listed as Not installed, make sure they are selected and click on the Install
packages… button again.
An alternative to using the Android SDK settings panel is to access the
Standalone SDK Manager which can be launched using the link in the lower
left-hand corner of the settings screen. The Standalone SDK Manager (Figure 2-
8) provides a similar list of packages together with options to perform update
and installation tasks:

Figure 2-8

2.8 Making the Android SDK Tools Command-line Accessible


Most of the time, the underlying tools of the Android SDK will be accessed from
within the Android Studio environment. That being said, however, there will
also be instances where it will be useful to be able to invoke those tools from a
command prompt or terminal window. In order for the operating system on
which you are developing to be able to find these tools, it will be necessary to
add them to the system’s PATH environment variable.
Regardless of operating system, the PATH variable needs to be configured to
include the following paths (where <path_to_android_sdk_installation>
represents the file system location into which the Android SDK was installed):
<path_to_android_sdk_installation>/sdk/tools
<path_to_android_sdk_installation>/sdk/platform-tools

The location of the SDK on your system can be identified by launching the
Standalone SDK Manager and referring to the Android SDK Location: field
located at the top of the settings panel as highlighted in Figure 2-9:

Figure 2-9

Once the location of the SDK has been identified, the steps to add this to the
PATH variable are operating system dependent:
2.8.1 Windows 7
1. Right-click on Computer in the desktop start menu and select Properties
from the resulting menu.
2. In the properties panel, select the Advanced System Settings link and, in the
resulting dialog, click on the Environment Variables… button.
3. In the Environment Variables dialog, locate the Path variable in the System
variables list, select it and click on Edit…. Locate the end of the current
variable value string and append the path to the Android platform tools to the
end, using a semicolon to separate the path from the preceding values. For
example, assuming the Android SDK was installed into
C:\Users\demo\AppData\Local\Android\sdk, the following would be
appended to the end of the current Path value:
;C:\Users\demo\AppData\Local\Android\sdk\platform-
tools;C:\Users\demo\AppData\Local\Android\sdk\tools

4. Click on OK in each dialog box and close the system properties control
panel.
Once the above steps are complete, verify that the path is correctly set by
opening a Command Prompt window (Start -> All Programs -> Accessories ->
Command Prompt) and at the prompt enter:
echo %Path%

The returned path variable value should include the paths to the Android SDK
platform tools folders. Verify that the platform-tools value is correct by
attempting to run the adb tool as follows:
adb

The tool should output a list of command line options when executed.
Similarly, check the tools path setting by attempting to launch the Android SDK
Manager:
android

In the event that a message similar to the following message appears for one or
both of the commands, it is most likely that an incorrect path was appended to
the Path environment variable:
'adb' is not recognized as an internal or external command,
operable program or batch file.

2.8.2 Windows 8.1


1. On the start screen, move the mouse to the bottom right-hand corner of
the screen and select Search from the resulting menu. In the search box,
enter Control Panel. When the Control Panel icon appears in the results
area, click on it to launch the tool on the desktop.
2. Within the Control Panel, use the Category menu to change the display
to Large Icons. From the list of icons select the one labeled System.
3. Follow the steps outlined for Windows 7 starting from step 2 through to
step 4.
Open the command prompt window (move the mouse to the bottom right-hand
corner of the screen, select the Search option and enter cmd into the search box).
Select Command Prompt from the search results.
Within the Command Prompt window, enter:
echo %Path%
The returned path variable value should include the paths to the Android SDK
platform tools folders. Verify that the platform-tools value is correct by
attempting to run the adb tool as follows:
adb

The tool should output a list of command line options when executed.
Similarly, check the tools path setting by attempting to launch the Android SDK
Manager:
android

In the event that a message similar to the following message appears for one or
both of the commands, it is most likely that an incorrect path was appended to
the Path environment variable:
'adb' is not recognized as an internal or external command,
operable program or batch file.

2.8.3 Windows 10
Right-click on the Start menu, select System from the resulting menu and click
on the Advanced system settings option in the System window. Follow the steps
outlined for Windows 7 starting from step 2 through to step 4.
2.8.4 Linux
On Linux this will involve once again editing the .bashrc file. Assuming that the
Android SDK bundle package was installed into homedemo/Android/sdk, the
export line in the .bashrc file would now read as follows:
export
PATH=homedemo/java/jdk1.7.0_10/bin:homedemo/Android/sdk/platform-
tools:homedemo/Android/sdk/tools:homedemo/androidstudio/bin:$PATH

Note also that the above command adds the androidstudio/bin directory to the
PATH variable. This will enable the studio.sh script to be executed regardless of
the current directory within a terminal window.
2.8.5 Mac OS X
A number of techniques may be employed to modify the $PATH environment
variable on Mac OS X. Arguably the cleanest method is to add a new file in the
etcpaths.d directory containing the paths to be added to $PATH. Assuming an
Android SDK installation location of Usersdemo/Library/Android/sdk, the path
may be configured by creating a new file named android-sdk in the etcpaths.d
directory containing the following lines:
Usersdemo/Library/Android/sdk/tools
Usersdemo/Library/Android/sdk/platform-tools

Note that since this is a system directory it will be necessary to use the sudo
command when creating the file. For example:
sudo vi etcpaths.d/android-sdk

2.9 Updating the Android Studio and the SDK


From time to time new versions of Android Studio and the Android SDK are
released. New versions of the SDK are installed using the Android SDK
Manager. Android Studio will typically notify you when an update is ready to be
installed.
To manually check for Android Studio updates, click on the Configure -> Check
for Updates menu option within the Android Studio welcome screen, or use the
Help -> Check for Update menu option accessible from within the Android
Studio main window.
2.10 Summary
Prior to beginning the development of Android based applications, the first step
is to set up a suitable development environment. This consists of the Java
Development Kit (JDK), Android SDKs, and Android Studio IDE. In this
chapter, we have covered the steps necessary to install these packages on
Windows, Mac OS X and Linux.
3. Creating an Example Android App in
Android Studio
The preceding chapters of this book have covered the steps necessary to
configure an environment suitable for the development of Android applications
using the Android Studio IDE. Before moving on to slightly more advanced
topics, now is a good time to validate that all of the required development
packages are installed and functioning correctly. The best way to achieve this
goal is to create an Android application and compile and run it. This chapter will
cover the creation of a simple Android application project using Android Studio.
Once the project has been created, a later chapter will explore the use of the
Android emulator environment to perform a test run of the application.
3.1 Creating a New Android Project
The first step in the application development process is to create a new project
within the Android Studio environment. Begin, therefore, by launching Android
Studio so that the “Welcome to Android Studio” screen appears as illustrated in
Figure 3-1:
Figure 3-1

Once this window appears, Android Studio is ready for a new project to be
created. To create the new project, simply click on the Start a new Android
Studio project option to display the first screen of the New Project wizard as
shown in Figure 3-2:
Figure 3-2

3.2 Defining the Project and SDK Settings


In the New Project window, set the Application name field to AndroidSample.
The application name is the name by which the application will be referenced
and identified within Android Studio and is also the name that will be used when
the completed application goes on sale in the Google Play store.
The Package Name is used to uniquely identify the application within the
Android application ecosystem. Although this can be set to any string that
uniquely identifies your app, it is traditionally based on the reversed URL of
your domain name followed by the name of the application. For example, if your
domain is www.mycompany.com, and the application has been named
AndroidSample, then the package name might be specified as follows:
com.mycompany.androidsample

If you do not have a domain name you can enter any other string into the
Company Domain field, or you may use ebookfrenzy.com for the purposes of
testing, though this will need to be changed before an application can be
published:
com.ebookfrenzy.androidsample

The Project location setting will default to a location in the folder named
AndroidStudioProjects located in your home directory and may be changed by
clicking on the button to the right of the text field containing the current path
setting.
Click Next to proceed. On the form factors screen, enable the Phone and Tablet
option and set the minimum SDK setting to API 14: Android 4.0
(IceCreamSandwich). The reason for selecting an older SDK release is that this
ensures that the finished application will be able to run on the widest possible
range of Android devices. The higher the minimum SDK selection, the more the
application will be restricted to newer Android devices. A useful chart (Figure 3-
3) can be viewed by clicking on the Help me choose link. This outlines the
various SDK versions and API levels available for use and the percentage of
Android devices in the marketplace on which the application will run if that
SDK is used as the minimum level. In general it should only be necessary to
select a more recent SDK when that release contains a specific feature that is
required for your application.
To help in the decision process, selecting an API level from the chart will
display the features that are supported at that level.
Figure 3-3

Since the project is not intended for Google TV, Android Auto or wearable
devices, leave the remaining options disabled before clicking Next.
3.3 Creating an Activity
The next step is to define the type of initial activity that is to be created for the
Random documents with unrelated
content Scribd suggests to you:
—Du veau! du veau!... Viande peu mûre, viande creuse...
Donnez-moi l’étole.
Il se croisa l’étole sur la poitrine et murmura quelques mots
latins.
—Avez-vous songé aux hors-d’œuvre? reprit-il gravement.
—Oui, monsieur le doyen: il y a un dindon à la broche.
—Comment, un dindon pour hors-d’œuvre! Êtes vous fou, par
exemple!
—Il est fort beau, il pèse douze livres.
—Vous ne me comprenez pas: je vous demande si vous vous
êtes procuré du beurre frais, des olives, du saucisson, du thon
mariné, des anchois...
—Non, monsieur le doyen. Mais Jeanneton a fait une croustade
magnifique.
—Quels entremets?
—Avec l’abatis du dindon...
—Ne me parlez plus de votre dindon! interrompit M. Michelin,
dont la gourmandise déçue avait enflé la voix. Venceslas Labinowski,
ce voleur, nous traita mieux l’année passée dans son ermitage, que
vous ne nous traitez dans votre cure. Quelle cuisine, Dieu m’assiste!
quelle cuisine!... Avez-vous pensé aux vins?
Le pauvre desservant, ahuri, balbutia:
—J’ai acheté cinquante litres de vin de Maraussan au frère
Barnabé, de Saint-Michel.
—Du vin quêté aux portes!... Il doit être bon! dit M. Michelin,
haussant les épaules. D’ailleurs, le maraussan est un vin liquoreux,
c’est un vin de dessert, et j’espère que vous n’oserez pas nous le
servir comme ordinaire.
—Mais j’ai du vin rouge du pays de cette année...
—Eh quoi! pas la moindre bouteille de saint-georges ou de
faugères?...
M. Martin, écrasé, ne répondit pas. Il prit sur le vestiaire le
manipule et avec une épingle l’attacha au bras droit du célébrant.
Celui-ci lui lança un regard où l’ironie et le dédain pétillaient
ensemble; puis, avant que le malheureux curé d’Hérépian lui
présentât la chasuble, l’enlevant de ses doigts crispés, il la revêtit
tout d’un coup. Il en nouait vivement les cordons, quand les ermites,
ayant mis quelque ordre parmi l’assistance, qui se bousculait dans la
chapelle trop étroite, étant parvenus surtout à obtenir un peu de
silence, reparurent dans la sacristie. M. le doyen leva la main,
indiquant par un geste à deux de ses vicaires qui venaient
d’endosser l’un la dalmatique de diacre, l’autre celle de sous-diacre,
de se ranger devant lui, et l’on marcha processionnellement vers le
chœur.
«Et moi? et moi? Je n’aurais donc pas la gloire de servir la messe
à M. le doyen?»
Hélas! je venais de recevoir la première grande humiliation de ma
vie. Malgré ma soutanelle rouge qui me seyait si bien, mon surplis
amidonné et raide comme une planche, ma calotte de cardinal, qui
me donnait un petit air de jeune pontife, je n’étais rien, on ne
m’avait pas vu, je n’existais pas.

Soudain, des éclats de rire m’emplirent les oreilles et


m’arrachèrent à ma mélancolie. C’étaient les ermites.
Après avoir discrètement fermé la porte de la sacristie, au lieu
d’assister à la messe qu’on célébrait solennellement, ils étaient là
tous les quatre, le dos à la muraille, devisant de joyeusetés. Quels
bons drilles que ces Frères libres de Saint-François! Pour l’instant, le
frère Agricol Lambertier, ermite de Saint-Pantaléon, de Boubals, avait
la parole:
—... Vous comprenez bien, disait-il, continuant le récit de je ne
sais quelle aventure galante, vous comprenez bien, mes amis, qu’en
dépit du coup de fourche reçu sur le bras, je ne lâchai point Victoire.
Je me souviens même que je l’embrassai au nez de celui qui voulait
me la prendre. Cependant il fallait en finir avec mon ennemi, qui à la
longue m’eût assommé sur place, et, retenant toujours la fillette
d’une main, je dépêchai de l’autre un si joli soufflet au perruquier de
Boubals qu’il en trébucha sur le sol.—«Pour t’apprendre, jeune
homme, lui criai-je, qu’il ne faut point me déranger dans mes folies
amoureuses, et que, parce qu’on tient un rasoir, on n’est pas capable
de faire la barbe au frère Agricol Lambertier...»
Barnabé éclata de rire, et si bruyamment que le frère Adon
Laborie, quittant sa place, d’un geste rapide lui appliqua une de ses
mains sur les lèvres.
—Comment, lui dit-il, vous n’êtes pas honteux de faire tout ce
tapage, quand, à deux pas de nous, on chante la sainte messe! Que
voulez-vous que pensent les fidèles assemblés, s’ils vous entendent?
Moi, malgré mes septante années, je suis allé à pied, ce matin, de
mon ermitage à Bédarieux, et à pied je suis arrivé jusqu’à Notre-
Dame avec la procession. J’ai cru que je tomberais de faiblesse en
montant la côte de Cavimont, et si, à cette heure, on ne me voit pas
suivre l’office divin, prosterné dans le chœur, c’est uniquement que
je crains de me trouver mal et de troubler la solennité en quelque
façon... Mais vous autres, ermites sans règle et sans discipline, que
faites-vous dans la sacristie? Croyez-vous, frère Gratien, que le
moment soit bien choisi pour nous parler de l’argent qu’on vous a
volé?... Pensez-vous, frère Agricol, que le lieu où nous sommes soit
l’endroit convenable pour y compter vos entreprises sur les filles de
Boubals?... Êtes-vous bien sûr, frère Barnabé, qu’en ce jour de fête,
nous nous soyons réunis ici, sous l’œil de la Sainte Vierge, pour y
rire tant seulement et pour y folâtrer!...
—Halte-là! frère Adon, je...
—Où sont les temps d’autrefois! interrompit l’ermite de Notre-
Dame de Nize avec mélancolie. Aux époques anciennes, les Frères
libres de Saint-François ne ressemblaient pas aux Frères libres
d’aujourd’hui. Au lieu de songer toujours à eux, comme nous autres
ici présents, comme ce malheureux Barthélemy Pigassou, qui n’aime
le prochain que pour le vin qu’il peut lui prendre, comme ce
misérable Venceslas Labinowski, lequel a trahi le bon Dieu à
l’exemple de Judas, ils étaient pieux, serviables à tous, ne quêtaient
jamais pour entasser, mais tout au plus pour se nourrir... Frère
Barnabé, j’ai connu l’ermite que vous remplaçâtes, c’était un saint;
tandis que vous...
—Oh! moi, s’empressa de dire le Frère de Saint-Michel, moi, j’ai
plus d’une peccadille sur mon âme, comme j’ai plus d’une verrue sur
mon corps. Que voulez-vous que j’y fasse, s’il n’a pas plu au bon
Dieu de me donner plus de qualités? En fin de compte, la faute en
est à lui qui, pouvant m’amender à plaisir, ne s’en occupe
nullement... Du reste, vous savez, mon fils Félibien est dans les
horlogeries, à Moret, département du Jura, et, de toute nécessité, je
dois travailler pour lui.
—Si c’est afin de gagner de l’argent à votre fils que vous êtes
entré dans notre Ordre, vous eussiez mieux fait de demeurer vannier
aux bords de la rivière d’Orb.
—Vannier! vannier! s’écria Barnabé presque furieux. Et vous,
pourquoi n’êtes-vous pas resté à la verrerie du Bousquet à souffler
des bouteilles. Je vois, frère Adon, que si pour moi il faisait trop froid
aux bords de la rivière, il faisait trop chaud pour vous devant la
bouche du four.
Aux joues blèmes du vieil ermite de Notre-Dame de Nize
s’allumèrent de petites flammes rouges, son œil à demi-éteint se
ranima, et, levant ses deux bras tremblants vers la porte de la
sacristie accédant au chœur:
—Mon Dieu, dit-il, Seigneur mon Dieu, je vous prends à témoin.
C’est pour mieux vous aimer, pour mieux aimer mon prochain, que
voici bientôt vingt ans j’entrai dans l’Ordre des Frères libres de Saint-
François. Dites à ces hommes qui m’accusent, dites-leur, mon Dieu,
si jamais je demandai un sou à personne, et si les pauvres du pays
ne profitèrent pas toujours des aumônes que m’avaient faites les
braves gens...
Sa voix faible expira dans les sanglots.
Les frères Gratien, Agricol, saisis, l’entourèrent et le conduisirent
vers son escabelle, qu’il ne retrouvait plus. Enfin, Barnabé, fort
embarrassé de son personnage, s’approcha à son tour tout hésitant,
tout penaud.
—Ermite de Saint-Michel, lui dit le frère Laborie surmontant son
émotion, le brigadier de gendarmerie de Bédarieux, avec qui je
causais l’autre jour, m’a avoué que, depuis votre méchante affaire
avec M. Cœurdevache, de Saint-Pons, il a les yeux sur vous. M. le
curé des Aires a eu beau donner cent francs, on vous surveille, je
vous en préviens charitablement. Je vous conseille à l’avenir d’imiter
mon exemple: voyagez sans monture et sans besace, ayez tant
seulement votre bourdon. Ainsi faisant, on ne vous soupçonnera pas
d’en vouloir au bien d’autrui.
Barnabé demeura interdit. Sa face se crispa et soudain devint
écarlate. Il n’est pas sûr que ce rustre, entraîné par son
tempérament sauvage, n’eût fait un mauvais parti à son confrère de
Notre-Dame de Nize, s’il se fût trouvé seul avec lui. Contraint de
réprimer les fureurs qui le soulevaient, il ouvrit brusquement la porte
de la sacristie et disparut dans la chapelle. Il avait besoin d’éviter les
lanières dont les coups lui bleuissaient la peau.
Les frères Agricol et Gratien, «qui n’étaient pas sans péché,»
redoutant aussi la correction, s’esquivèrent.
«Quels ermites! marmotta frère Adon Laborie, joignant
dévotement ses mains où reparurent les grains de son chapelet,
quels ermites!»
Moi, je dépouillai ma soutanelle, mon surplis, ma calotte, et,
comme une anguille, m’étant coulé entre les flots des assistants, je
me sauvai à travers le plateau.
VI
Un bataille de bébés sur «les pas de la sainte Marie.»

La campagne, aux alentours de Notre-Dame de Cavimont,


apparaissait encombrée de monde. C’était un véritable champ de
foire, bariolé de coiffes et de fichus, au milieu desquels des
pyramides de chapeaux se trouvaient noyées. De tous les coins
s’élevaient des cris, des paroles vives, d’interminables
chamaillements.
Tandis que le petit nombre des pèlerins entendait la messe avec
dévotion et recueillement, la foule, accourue ici pour se gaver de
viandes et de vins, vautrée dans l’herbe, au bord des ruisseaux
babillards, ne songeait qu’à découvrir une place commode pour y
festiner à l’ombre noire des granits. Quelles contestations, quelles
colères, quels bousculements sans pitié! Et, parmi tout ce désordre
enragé, les bêtes, effrayées, de braire, de hennir, de se cabrer. Je vis
un mulet, oreilles effilées, poil hérissé, queue en panache, passer
devant moi rapide comme le vent, et disparaître tout à coup.
Évidemment l’endroit recherché de préférence était la Source ou
ses environs immédiats. L’eau chantant sur les cailloux invite
doucement à la gaieté; puis quelles délices de boire frais, quand on
vient de traverser la plaine sous le soleil! De véritables masses,
bruissantes comme des essaims, se précipitaient vers ces parages
privilégiés.
J’avais hasardé un pas vers la Source,—peut-être comptais-je y
retrouver mes hôtes ailés du matin;—malheureusement, pressé de
toutes parts et redoutant d’être entraîné, je dus battre de toutes
mes forces en retraite.
Enfin je me retrouvai libre à l’autre extrémité du plateau. C’était
l’endroit le plus désert, le plus sauvage du bloc de Cavimont, mais à
coup sûr le plus intéressant.
La tradition veut qu’à une époque difficile à préciser,—«dans les
siècles,» comme disent nos paysans,—la Sainte Vierge,
accompagnée de sainte Anne, sa mère, ait fait des apparitions
nombreuses sur le rocher de Cavimont. Elle descendait du ciel tout
exprès pour convertir la vallée d’Orb, adonnée en ces temps lointains
à toutes les débauches, à toutes les impiétés. La trace des pas de
«la sainte Marie» reste encore visible dans le granit, et c’est une
croyance enracinée dans nos montagnes que, pour fortifier un
enfant faible, malingreux, chétif, il suffit de lui poser les pieds dans
ces vestiges sacrés. Du reste, chose singulière et touchante! cette
partie du plateau demeure l’objet du respect de tous: c’est le côté de
«la sainte Marie,» et il est abandonné sans conteste aux mères et
aux enfants.
J’arrivai là juste au moment où allait avoir lieu, sur la pierre nue,
la promenade pieuse des bébés. Quatre-vingts mères, peut-être
cent, de tout âge, de toute condition, les unes habillées de soie, les
autres de simple droguet, se tenaient debout, portant chacune un
poupon dans ses bras. Quelques-uns de ces pauvres petits, fatigués
sans doute par le voyage, pleuraient; la plupart montraient des
minois frais, éveillés et se contentaient de regarder avec de grands
yeux étonnés.
La cloche de la chapelle sonna le premier coup de l’Elévation. M.
Martin, d’Hérépian, parut, une aumônière de velours rouge à la
main, et le pèlerinage «aux pas de la sainte Marie» commença.
Je ne me souviens pas d’avoir, de ma vie, rien vu de plus
gracieux, de plus charmant que toutes ces mignonnes jambettes
rebondies de petites filles, de petits garçons, s’entrecroisant sur le
granit et cherchant, sous la direction des mères attentives, les trous
où il fallait s’arrêter. Parfois il arrivait que trois pieds aux ongles
éclatants comme des feuilles de roses se présentaient pour se
«fortifier» ensemble dans la même trace. Alors, le plus énergique
repoussait les deux autres avec indignation, et c’étaient des cris
accompagnés de larmes. Combien j’en aperçus de ces beaux yeux
d’enfants, limpides tout à l’heure comme l’eau de la Source, brouillés
maintenant et battus! Les mères, certes, s’interposaient dans ces
combats mutins, mais leurs voix étaient rarement écoutées.
—Méchant! méchant! répétait avec orgueil une jeune femme à
son fils récalcitrant et batailleur.
Celui-ci la regardait, souriait, et elle, pour réduire le révolté, lui
dévorait les joues de baisers.
M. le curé d’Hérépian n’avait garde d’oublier pourquoi M. Michelin
l’avait envoyé, et, tout en racontant les apparitions célestes dans la
vallée d’Orb pervertie, de temps à autre il présentait aux pèlerines,—
plus souvent aux dames qu’aux simples paysannes,—sa bourse de
velours large et béante comme un gouffre. Des sous y tombaient
des mains crochues des montagnardes, mais des doigts gantés des
citadines s’échappaient des pièces blanches et quelques rares louis.
A ces bruits de monnaies, les marmots dressaient l’oreille, puis
reprenaient leurs enjambées.
Le prêtre parfois, s’arrachant au récit de la légende, se tournait
vers une pauvre femme inquiète et la rassurait sur l’état de son
enfant. Il lui racontait des guérisons miraculeuses. Il fallait voir avec
quelle avidité la malheureuse mère buvait ses paroles! L’espérance
n’était-elle pas déjà une consolation?
—Tenez, madame, dit M. Martin, au moment où la procession
enfantine défilait devant moi, il y a quelques années, nous avons eu
à Cavimont un enfant de Bédarieux que les médecins avaient
abandonné. La Sainte Vierge l’a guéri; mettez votre confiance en
elle.
Une subite émotion m’envahit: dans mon enfance maladive,
durant trois années, à la fête du printemps, ma mère, me guidant à
travers le roc de Cavimont, m’avait fait parcourir un à un «les pas de
la sainte Marie.» Qui sait si ce n’était pas de moi que voulait parler
M. Martin? Le souvenir de ma mère m’emplit l’âme, et, comme
quelqu’un qui a peur, je pris mes jambes à mon cou.
Me heurtant les coudes à chaque seconde, j’eus envie d’en finir
une fois pour toutes avec la multitude des pèlerins, et, en attendant
Barnabé qui me rejoindrait après la messe, de me réfugier à
l’ermitage. D’ailleurs, dans la basse-cour dépeuplée, ne trouverais-je
pas Baptiste paissant les herbes poussées çà et là le long des murs?
Il devait bien s’ennuyer tout seul, ce mien ami!
Je posais la main sur le loquet de la masure décrépite de
Cavimont, quand je m’entendis appeler. Je me retournai surpris.
Dieu! c’était Simonnet Garidel. Son visage épanoui rayonnait comme
un soleil. Pensez donc, il avait Juliette Combal à son bras!
—Eh bien! il paraît que vous faites des vôtres déjà! leur dis-je.
Vous allez vite en besogne vraiment... Et vos parents, où les avez-
vous laissés?
—Mon père est par là, fit Simonnet, étendant son bras dans la
direction de la Source.
—Le mien aussi, se hâta d’ajouter Liette.
—Et la messe?
—Nous sommes sortis de l’église pour aller visiter sainte Anne la
Marieuse, me répondit le jeune Garidel.
Puis, d’un ton plus bas, presque mystérieux:
—Tu sais bien, c’est au moment de la Communion que les
personnes dans notre position vont la voir.
—Bien! bien! m’écriai-je, vous n’avez qu’une idée en tête, vous
autres, celle de vous marier. Bon Dieu! mariez-vous. Cela m’est bien
égal.
Et, d’une secousse, j’ouvris la porte de l’ermitage.
—Alors, tu ne veux pas venir prier sainte Anne pour nous?
C’était la petite voix de Liette, la voix flûtée d’un oiseau, qui avait
prononcé ces paroles.
Je regardai la jeune fille. Elle baissa son front tout rougissant.
—Donc un Pater de moi à sainte Anne la Marieuse te ferait plaisir,
Liette?
—Oui, soupira-t-elle.
—Tu crois qu’au ciel on écoute mes prières?
—N’es-tu pas le neveu de M. le curé des Aires, un véritable saint?
L’argument me parut irrésistible. Puisque j’étais le neveu de mon
oncle, je devais me montrer bon prince. Je refermai l’ermitage, et,
Liette lui tenant déjà le bras gauche, je pris le bras droit de
Simonnet.
La légende citée plus haut rapporte que, tandis que «la sainte
Marie» se promenait sur les granits, sainte Anne l’attendait à
quelque distance, «en récitant son chapelet tranquillement.» On
connaît la pierre sur laquelle elle s’assit, et cette pierre, conservée
dans l’étroit sanctuaire édifié en l’honneur de la sainte, accomplit
tous les ans de nombreux prodiges. Non-seulement elle a la vertu
singulière de redresser les membres déviés qui la touchent, de guérir
«de tous maux et maladies» les dévots qui la baisent pieusement;
mais elle possède par-dessus tout le privilége incomparable de faire
aboutir les mariages les plus hérissés d’obstacles, les plus
invraisemblables, les plus empêtrés. Pourvu que «les deux amis»
posent en même temps leurs lèvres sur la paroi du bloc miraculeux,
qu’ils récitent cinq Pater et cinq Ave, laissent une aumône «pour
l’entretien du culte,» ils verront toutes les difficultés s’évanouir et
leur mariage se réaliser dans un temps prochain. Pourquoi sainte
Anne, qui elle-même était mariée à saint Joachim, ne se serait-elle
pas faite la protectrice, la zélatrice du mariage? De là, en toute
l’étendue des Cévennes méridionales, son nom de sainte Anne la
Marieuse.
Après avoir contemplé les petits bébés riant ou pleurant à travers
les granits, je vis ici les grands bébés amoureux. Aucun ne riait, mais
en retour plus d’un avait des larmes plein les yeux. Ils s’avançaient
en colonne serrée, le jeune homme retenant doucement la jeune
fille et la couvant de l’œil, de l’âme, de tout son être à qui la passion
avait imposé son joug. Quelles chevelures splendides, brunes,
blondes, rousses, débordaient des coiffes étincelantes de blancheur!
Quels yeux adorables, depuis le bleu pâle jusqu’au noir luisant et
profond, tantôt vaguant dans l’espace, puis regardant tout et ne
voyant rien.
Les jeunes gens étaient vraiment superbes avec leurs épaules
carrées, leurs cheveux tenaces, leurs têtes que de temps à autre ils
relevaient fièrement. L’amour, en leur faisant sentir l’aiguillon divin
qui fait saigner le cœur, mais l’endurcit à la vie, avait allumé dans
leurs prunelles je ne sais quelle flamme qui, les transfigurant, leur
communiquait l’idéale beauté. Non, ce n’étaient pas les mêmes
hommes que j’avais vus, hier encore, courbés sur le sillon, la mine
inquiète, suant, acharnés à faire jaillir le pain de tous de notre sol
ingrat. Maintenant ils étaient droits comme des peupliers, sereins
comme des mages, inconscients comme la nature elle-même, leur
mère et leur nourrice. Dieu tout à coup venait de les refaire neufs,
pour célébrer la fête de l’amour, l’unique fête de la vie.
Après une demi-heure d’attente, Juliette et Simonnet pénétrèrent
enfin dans le petit sanctuaire.
Bien que je ne fusse pas à la veille de me marier et qu’à mon
bras manquât la fiancée, je m’y glissai en contrebande derrière mes
deux amis.
La pierre où se reposa sainte Anne la Marieuse, s’élance du
milieu des dalles à deux pas de l’autel. C’est un bloc noirâtre, à
peine équarri, d’une hauteur d’un mètre environ, une sorte de
menhir que les attouchements, les frôlements, les baisers ont aminci
vers le sommet. Pourquoi la mère de la Sainte Vierge, qui pouvait
trouver tant d’autres endroits où s’asseoir, choisit-elle précisément
cette colonne, où elle ne dut se maintenir que par des prodiges
d’équilibre? La légende n’en parle point.
Je retrouvai l’éternel M. Martin, perché sur une haute escabelle, à
côté de la pierre miraculeuse. Les amants, avec des tremblements
aux lèvres et aux genoux, ayant baisé la singulière relique, le brave
homme, qui pourtant ne devait pas prélever un denier sur l’aubaine,
car le curé de Bédarieux faisant aujourd’hui les frais de la
procession, le casuel lui revenait de droit, leur présentait son sac de
velours.
Nous avancions peu à peu. Encore deux couples à passer, et
notre tour arrivait. Liette était aussi pâle que son bonnet de batiste,
dont les brides s’effaçaient dans la blancheur mate de ses joues.
Simonnet avait les traits sérieux, les lèvres graves, le menton serré.
Pour moi, je me sentais aux prises avec une grande inquiétude:
baiserais-je, ne baiserais-je pas?
Nous nous trouvâmes devant M. Martin. J’étais fort troublé.
Soudain, derrière l’autel, semblable à un rossignol préludant dans
la feuillée nouvelle, éclata le fifre de Braguibus.
Les assistants levèrent la tête. M. Martin, étonné, se retourna. Je
profitai du moment; je collai mes lèvres sur la pierre de sainte Anne
la Marieuse, à côté des lèvres de Liette et de Simonnet.
—Sainte Anne la Marieuse, mariez-moi, je vous prie! articula le
jeune homme à haute et intelligible voix.
Puis il laissa tomber une pièce de cinq francs dans l’escarcelle de
M. Martin.
—Sainte Anne la Marieuse, mariez-moi, je vous prie! murmura à
son tour la jeune fille.
Et, elle aussi, glissa un gros écu dans la bourse de velours.
—Et toi, tu ne donnes rien, petit? me dit M. Martin, souriant.
Je crus son invitation sérieuse, et, passant les doigts dans mon
gousset, j’en arrachai deux sous doubles qui ressemblaient à des
louis, tant je les avais polis en m’amusant au bouchon. Je jetai
bruyamment mon trésor dans l’aumônière du curé d’Hérépian.
Nous sortîmes.

Simonnet rayonnait de bonheur; quant à Liette, elle tenait la tête


un peu baissée, mais elle allait si preste, si légère, qu’on eût dit
plutôt un oisillon voletant parmi les lavandes et le thym, qu’une
personne humaine marchant au milieu des pierrailles, les pieds
serrés dans des souliers.
—Es-tu contente, mignonne? lui demanda Simonnet, se décidant
en fin de compte à déclaver les dents.
—Je suis bien contente, répondit-elle... Et toi? s’informa-t-elle,
relevant son visage où reparut quelque mutinerie.
—Oh! moi, les anges me portent. Non, il ne me souvient pas de
m’être trouvé jamais à pareille fête. Il me semble, ma Liette, en ce
moment, que je suis plus riche que toi, que tout ce que nous voyons
m’appartient: la terre, le ciel et même ce soleil que le bon Dieu fait
briller là-haut près de lui. Ah! les jours de moisson, les jours de
cueillette de nos châtaignes, quand tout était plein aux greniers et
dans les séchoirs et qu’on n’avait plus de sacs pour recevoir la
récolte, furent pour moi des jours malheureux comparés au jour
d’aujourd’hui!... Tiens, veux-tu que, pour te prouver ce qu’il en est
de moi présentement, je te presse dans mes bras et t’embrasse?
—Et si l’on nous voit?
—Que peut faire cela! Le bon Dieu nous voit bien, et son soleil
aussi qui n’est pas aveugle.
—Mais...
Il lui ferma la bouche à grands coups de baisers.
Des éclats de rire retentissants ébranlèrent l’air derrière nous.
C’était Barnabé avec M. Combal.
—En voilà des tourtereaux, en voilà des tourtereaux! s’exclama le
Frère joyeusement. A la bonne heure! il paraît que sainte Anne la
Marieuse n’a pas mis la brouille dans le ménage... Allons, consolons-
nous de vieillir, monsieur le maire, le monde n’en est pas à son
dernier poupon. Vive la vie!
M. Combal, voyant sa Liette heureuse, la regardait tout ébahi.
—Ah ça! les amis, reprit Barnabé, les embrassements ne valent ni
fougasse ni vin, et encore que baiser une figure gentille et fraîche
comme la figure de Liette soit un passe-temps de paradis, peut-être
conviendrait il de ne pas oublier la pitance pour l’estomac. Le soleil
étant dans sa rage, il nous amène midi. Nous agirons donc
sagement en cherchant tout de suite une place à l’ombre pour y
faire travailler nos mandibules en parfaite tranquillité. Le clergé s’en
va dîner chez M. Martin, à Hérépian, tout est fini, et je n’en suis
point fâché. «—Bon voyage, monsieur le curé-doyen de
Bédarieux...» Allons, Simonnet, fais un peu trêve à ta Liette, et
puisque, d’après ce que vient de me dire M. le maire, tu es venu
jusqu’ici avec ton cheval chargé de provisions pour tous, dis-nous où
nous devons nous asseoir et attaquer le rôti. Je sens les dents qui
me tombent de besoin.
—Suivez-moi, répondit laconiquement le jeune homme qui ne
paraissait pas content.
Et, sans laisser la main de Liette, il marcha, devisant avec elle,
devant nous.

A cent mètres environ de la Source, en descendant vers


Villemagne, la roche granitique qui couronne le monticule de
Cavimont craque, s’entr’ouvre, s’écartèle pour ainsi dire. Au bas de
cette cassure gigantesque, des prairies, avivées par l’eau qui sort du
bloc à gros bouillons, étalent leur tapis d’un vert profond, presque
noir.
Le soleil ne pénétrant guère en ces endroits trop enfouis, les
herbes n’ont pu prendre ces couleurs tendres, transparentes,
lumineuses, dont elles se revêtent ailleurs. L’ombre éternelle qui les
couvre leur a imprimé ses teintes de deuil et de mélancolie. Des
sorbiers maigres, lépreux, poussent comme à regret aux bordures de
ces gazons vivaces, mêlés aux lavandes, aux cystes, aux genévriers
épineux, seule décoration végétale de ces laves éteintes et désolées.
Au tronc d’un arbre chauve, je vis attaché le cheval des Garidel.
Non loin, se trouvait assis le père de Simonnet. Braguibus était là
aussi, occupé à tendre sur le gazon une grande nappe blanche, dont
quelques pierres polies aux torrents retenaient les bords. Du reste,
c’étaient partout des gens en train de dresser la table et de retirer
les victuailles des paniers.
Afin de rejoindre le vieux Garidel, lequel, bien que très religieux,
s’était résigné à manquer la messe de Notre-Dame pour nous garder
une place commode, nous dûmes descendre le cours de l’eau.
Le ruisseau, s’échappant de la fontaine en bondissements
tapageurs parmi les veinules du granit qui percent la peau çà et là,
offrait en ce moment le plus singulier spectacle. Il était obstrué de
bouteilles de haut en bas: ici, des bordelaises montrant leurs goulots
capuchonnés de cire rouge; plus loin, des bourguignonnes aux cols
plus allongés cachetées de vert; puis l’armée innombrable des
flacons ordinaires de toute forme et de toute grosseur; enfin, clair-
semés au milieu de ces verreries diverses, des cruchons de grès où
la bière mousseuse rafraîchissait.
—Quels jolis cailloux! s’écria Barnabé, dont l’œil s’alluma.
Nous franchîmes le courant d’un bond et rejoignîmes notre
monde.
VII
Braguibus, nouveau Pan, mène le chœur des Nymphes, des Faunes et des
Sylvains.

Les Garidel, autrefois, possédaient un troupeau de trois cents


chèvres environ, la plus belle cabrade peut-être des Cévennes
méridionales; aujourd’hui, leur richesse en bétail avait diminué
comme toutes leurs autres richesses, et c’était à peine si, à leur
borde de Margal, vingt chèvres aux plantureuses mamelles
broutaient parmi les rocailles, sous la conduite d’un bouc
magnifiquement encorné.
Cependant ces bêtes, chevrotant vers février, suffisaient à
approvisionner la maison de cabris, et je ne fus pas étonné quand
Simonnet déposa sur la nappe, tirée comme un linge sur la grave,
deux chevreaux rôtis au four et panés. Tous les yeux
s’équarquillèrent. Barnabé se frotta les mains bruyamment, et
Braguibus eut un sourire discret.
—Moi, dit l’ermite, donnant du fil à son couteau catalan en le
passant et le repassant sur la queue de sa fourchette, je ne reculai
jamais devant un quartier de cabri. Encore que cette viande ne soit
pas des plus rassasiantes, elle est si blanche, si fraîche, qu’on y
plante les gencives avec satisfaction. Ça ne résiste pas plus que le
poulet de grain ou le caillé. La chose se comprend du reste, ces
bêtes, jusqu’à ce jour, n’ont mordu qu’aux mamelles de leurs
nourrices, et c’est bien naturel si elles sont tendres comme le lait
qu’elles ont tété.
D’un coup de fourchette hardi, il enleva un cuissot entier de
chevreau.
—Il paraît, Barnabé, que l’air de Cavimont vous a singulièrement
creusé l’estomac, lui dit M. Combal un peu offusqué. Vous ne
choisissez pas mal votre morceau.
—Est-ce que par hasard vous avez la goutte aux dents, vous,
monsieur le maire? Je vous plains. Pour moi, mes meules sont
solides et ne demandent qu’à virer sur le bon froment. Au
demeurant, il y aura de la pitance pour la compagnie. Vous, d’abord,
vous ne mangez pas gros; le père Garidel n’a pas l’appétit d’un
sergent; Braguibus porte en ses intérieurs un estomac de papier
mâché; le neveu de M. le curé, c’est un oiseau, pas un homme;
quant à nos deux amoureux, ils mordent à l’amour, et je vous
réponds que ce pain-là en vaut bien un autre. Ce n’est pas du pain,
l’amour, c’est de la fougasse de paradis... Connu!
Il eut un éclat de rire si gras, si rond, qu’une dizaine de
Pénitents-Bleus, qui, leur sac encore noué aux reins et leur
capuchon renversé sur le dos, dînaient à quelques pas, avec femmes
et marmots, tournèrent curieusement leurs têtes vers nous.
—Eh bien! s’écria le Frère, heureux de l’émotion qu’il provoquait,
est-ce que ma gaieté vous gêne, vous autres, par exemple? Moi, je
ne ressemble pas à Braguibus, lequel est mélancolieux à la mort: je
trouve le cabri bon, le vin excellent, la vie meilleure que tout cela, et
je ris comme un coffre. D’abord, sachez cela, Pénitents de
Bédarieux, la joie est chose divine, et les Apôtres furent bien
contents lorsqu’ils virent ressusciter Notre-Seigneur...
Une détonation se fit entendre. Un bouchon, volant à plusieurs
mètres au-dessus de nous, tomba juste dans l’assiette de Barnabé.
—Voilà la bière qui m’appelle! dit-il.
Il se leva, saisit son verre, et alla vers le groupe des Pénitents-
Bleus. Ceux-ci, qui étaient de bons et joyeux drilles, lui firent un
accueil enthousiaste. Tandis qu’une main empressée lui versait de la
bière, une autre lui tendait une assiette où se trouvait étalée une
tranche de gigot froid.
—Du mouton! s’écria le Frère. Enfin, je vais goûter de la vraie
viande!.. Adieu, les amis, ajouta-t-il, nous envoyant une révérence
ironique.
Il plia les deux genoux et s’installa.

—Quel homme, ce Barnabé! murmura le père Garidel avec un


haussement d’épaules. Encore qu’il soit ermite, il aime mieux la
mangeaille que son habit et sa religion.
—Que voulez-vous? intervint Braguibus, ce n’est pas sa faute au
Frère de Saint-Michel, s’il a un appétit de loup. Malgré ses dents trop
longues, il est bon et serviable tout de même.
—Pour moi, je n’eus jamais à me plaindre de l’ermite, et sa
nature franche, délibérée, me rendit son ami depuis bien des
années, dit M. Combal.
—Je lui donnerais la moitié de ma personne, moi! s’écria
Simonnet tout d’un élan.
—Et l’autre moitié, qu’en ferais-tu? lui demanda finement
Braguibus.
—L’autre moitié pour ma Liette, répondit-il.
Le vieux Garidel, comme atteint par ces dernières paroles, ne sut
contenir un geste de dépit. Puis, regardant le père de Liette avec des
yeux où l’émotion de son cœur venait d’étendre un brouillard:
—Ambroise Combal, lui dit-il, nos jeunes gens s’aiment; en eux, il
ne reste plus rien pour nous. Nous pouvons mourir à présent.
Liette et Simonnet courbèrent la tête, comme honteux de leur
bonheur.
—Ne soyez pas tristes, mes enfants, intervint M. le maire, dont la
voix se mit à trembler. Ce que vous nous faites, au père Garidel et à
moi, nous le fîmes nous-mêmes à nos parents, et vos enfants vous
le feront un jour. La vie marche de ce pas cruel sur la terre, écrasant
tout sur son chemin, les pauvres vieux principalement qui ne sont
plus utiles à rien. Dieu a bien fait le partage des joies et des
chagrins: d’abord les joies, pour que les lois du mariage, qui sont
saintes, s’accomplissent; puis les chagrins, pour nous préparer à
quitter ce monde où notre voyage est terminé... Néanmoins cela, je
suis content et ne me contriste aucunement au mariage de ma
Liette... Ma Liette se marie? Tant mieux! Je demande au ciel de les
bénir, elle et son mari, afin qu’il y ait bientôt du bruit chez nous, et
que, semblablement à un essaim d’abeilles, j’entende bruire des
enfants sur le plancher de la maison.
M. Combal s’arrêta court. En racontant son bonheur, les sanglots
lui étaient montés à la gorge et avaient étouffé sa voix. Le vieux
Garidel pleurait. Liette cachait sa tête dans son joli tablier de taffetas
noir, tandis que Simonnet promenait dans le vide des regards sans
pensée, presque éperdus.
Je touchai le coude à Braguibus, tombé dans une contemplation
singulière.
—Allons, un coup de fifre! lui dis-je.
Par un geste machinal, il porta l’instrument à ses lèvres, et d’un
plein souffle lança aux échos profonds de la Source l’air très alerte
de la chanson de Barnabé.
—Eh bien! eh bien! s’écria le Frère, qui reparut incontinent au
milieu de nous, et, d’un mouvement brusque, rabattit les doigts à
Maniglier. Ce n’est point l’heure des chansons à présent, c’est l’heure
des contredanses et des bourrées!... A deux pas d’ici, la prairie est
large, et il s’y forme des groupes de filles et de garçons. On n’attend
que le musicien pour commencer. Ah! bien oui, chanter, quand
l’estomac a sa subsistance! Il faut donner aise aux jambes et laisser
la voix en repos. En avant deux, l’ami!
Saisissant Braguibus au bras droit, il l’enleva comme une plume,
puis l’entraîna.
Curieux de voir, je me jetai sur leurs talons.

L’eau appelle le gazon. A la naissance de la Source, les herbes


commencent, et ce tapis de verdure, d’abord déchiré par les roches
saillantes en maints endroits, s’élargit à mesure que les parois du
granit s’écartent davantage et finissent par disparaître dans les
profondeurs du terrain. A deux cents mètres environ de la fontaine
jaillissante, c’est une véritable prairie avec ses marguerites blanches,
ses boutons d’or, ses graminées aux lancéoles délicates et menues.
M. Étienne Baticol, à qui, sauf l’ermitage, propriété de la commune
d’Hérépian, appartient tout entier le monticule de Cavimont,
prévoyant la multitude qui, aux approches de la fête, devait fouler
ses foins, les avait fait couper huit jours avant Pâques. Les herbages,
largement abreuvés, redressaient de nouveau leurs pointes, mais
juste assez pour favoriser les glissades des danseurs, trop peu pour
embarrasser leurs pieds.
Quand nous arrivâmes à cette esplanade verdoyante, luisante
encore sur ses bords du tranchant de la faux, elle était déjà envahie
par la foule: partout des jeunes gens et des fillettes devisant, têtes
penchées.
Çà et là, des groupes de Pénitents; leurs sacs, fraîchement
blanchis et repassés, trop éclatants au soleil, jetaient des notes
criardes sur l’émeraude des gazons. Ces religieux de circonstance,
dont plusieurs, bien que maçons, ébénistes, journaliers pour la terre,
affichaient des panses rebondies, graves comme des chanoines,
discutaient avec force gestes quel serait le drapeau qu’on planterait
au milieu du bal.
L’année précédente, le drapeau jaune des Pénitents-Bleus ayant
obtenu l’honneur de présider aux danses, pourquoi le drapeau
écarlate des Pénitents-Blancs ne flotterait-il pas à son tour sur le
pré?
Malgré les vociférations, les menaces de quelques Pénitents-
Bleus difficiles à réduire, les Pénitents-Blancs l’emportèrent dans le
débat, comme c’était justice, et leur couleur victorieuse fut déroulée
aux yeux de tous.
Ma surprise fut grande de rencontrer à travers cette foule
affairée, turbulente, joyeuse, les ermites de Saint-Pantaléon de
Boubals et de Saint-Sauveur de Camplong, que je croyais partis avec
le clergé de Bédarieux. Certes, je n’ai rien à dire du frère Gratien,
lequel, les mains embarrassées de chapelets et de médailles,
cherchait à débiter sa pieuse marchandise parmi les pèlerins; mais
peut-être pourrais-je affirmer que la conduite du frère Agricol était
moins édifiante. Ainsi, sous mes yeux, je le vis pincer à la taille la
même grande et forte fille avec laquelle il polissonnait à la
procession.
—Victoire! Victoire! lui disait-il toujours.
Et celle-ci, de se retourner et de rire de ses trente-deux dents.
Le frère Agricol Lambertier allait-il danser avec Victoire? Je pensai
bien qu’il n’oserait pas.
Cependant, de toutes parts, on avait aperçu Jean Maniglier, et on
l’entourait, on le pressait. Barnabé, serré lui-même de près, joua des
bras. Enfin, ayant réussi à repousser le flot, il se hissa sur la pointe
des pieds; puis, élevant la voix:
—Les amis, dit-il, Braguibus, qui à lui seul a plus de musique
dans la cervelle que tous les musiciens des Cévennes ensemble, a
inventé une contredanse nouvelle. Il l’appelle: «La Montagnarde.» Si
vous voulez cette contredanse, plus amoureuse que les autres,
puisque, au lieu d’embrasser tant seulement une fois sa danseuse,
on l’embrasse trois fois: au commencement, au milieu, à la fin,
Braguibus vous la jouera de grand cœur. Mais il pose une condition:
c’est qu’avant d’engager le pas, chacun laissera tomber deux sous
dans son chapeau. Braguibus «n’a pas des chevilles d’or» comme M.
Étienne Baticol, et, pour que son fifre chante, il convient
premièrement que son estomac soit bien plein. Vous êtes avertis.
—La Montagnarde! la Montagnarde! vociférèrent mille voix.
Barnabé arracha son chapeau à Jean Maniglier, et, tout en
accompagnant l’artiste jusque sous le drapeau des Pénitents-Blancs,
il quêta dans toutes les directions.
Ce fut une grêle de monnaie.
Au moment où Braguibus, installé sur le gazon, les jambes
repliées et le dos appuyé à la hampe du drapeau, portait
l’instrument à ses lèvres, Barnabé lui retint le bras, et, s’adressant à
la foule:
—Que tout se passe chrétiennement, au moins! s’écria-t-il.
Incontinent, le fifre se donnant carrière, l’énorme branle-bas
commença. Ce furent des va-et-vient rapides, des bondissements
désordonnés, des bousculements formidables, d’où s’échappaient
ensemble des cris de joie et des cris de douleur. Je vis plus d’un
couple, pris de vertige, mesurer la profondeur du gazon, puis, se
relevant, le front rouge de honte, repartir de plus belle à travers la
prairie. L’entrain était admirable, le tournoiement diabolique.
Lorsque Braguibus, par un silence, indiqua le moment venu des
embrassements, la débandade devint générale. Tandis que de rares
filles, honnêtes et simples, en toute naïveté, acceptaient sur leurs
joues enflammées les gros baisers de leurs danseurs, le plus grand
nombre de nos Cévenoles, subitement effarouchées, s’enfuirent vers
les rocailles où l’ombre tombait épaisse pour s’y blottir et s’y cacher.
Heureusement on les rejoignit bien vite, et ce n’est pas un baiser
unique qu’elles reçurent, les ingénieuses coquettes, mais deux, mais
trois, mais dix, mais autant qu’il en fallut pour dissiper leur
épeurement.
A quelques pas de nous, nous aperçûmes, Barnabé et moi, un
Pénitent-Blanc qui s’en donnait, sur un frais visage, à cœur et à
lèvres déboutonnés. Puis encore devinez qui nous avisâmes, derrière
une haie d’épines abornant la salle de bal? M. Anselme Benoît, M.
Anselme Benoît, des Aires, avec sa belle femme aux rubans de feu.
—Gardez donc ces caresses pour vos malades, monsieur le
médecin! et ne laissez pas tomber vos lunettes, lui cria l’ermite, dont
un rire retentissant dilata l’immense bouche à en détacher le
menton.
Puis soudain m’interpellant:
—Allons, pétiot, il va nous falloir remonter à Cavimont. Si ce
matin nous avons tout dressé sur pied, c’est à nous encore, avant de
partir, à mettre de l’ordre dans les deux chapelles et dans l’ermitage.
Je pense que M. Michelin va bientôt nommer un Frère, et que la
besogne de tout nettoyer par ici ne tombera pas sur mes bras à
chaque procession... Braguibus travaillera tranquillement. D’abord
j’ai confiance en lui, et je sais bien que j’aurai ma part des sous de
son chapeau. Nous sommes associés pour les bals comme pour les
chansons...
Nous nous éloignâmes de la prairie, remontant vers Cavimont par
le sentier vert de la Source.
Barnabé se parlait à lui-même tout en cheminant:
—Je m’étais promis, en quittant Saint-Michel, se disait-il, de faire
une tournée aux environs de Saint-Gervais et de pousser peut-être
jusqu’à Murat. Mais ce brigand de Venceslas Labinowski m’empêche,
cette année, d’aller à la quête de la saucisse... Aux environs de
Pâques, la saucisse est juste à point, dure, fraîche, savoureuse. C’est
dommage! on est si généreux pour moi au Pradal, à Douch, à
Rosis!... Que faire? Je ne puis pourtant pas laisser mon argent tout
seul à Saint-Michel, pour que ce Polonais le découvre et me le vole.
Seigneur du ciel! près de huit mille francs de beaux écus blancs, en
un gros bas de coton bleu, sous un pavé de l’ermitage... Quand
j’aurai dix mille francs, Félibien s’établira... Quel jour!... Je
demanderai à Simonnet Garidel son fusil à deux coups et ses
pistolets à M. Anselme Benoît; puis, si Venceslas se montre, avant
qu’il ait ouvert la bouche pour me crier le mot de tous les voleurs:
«De l’argent! de l’argent!» moi, je l’abats comme un gibier...
Je m’arrêtai: j’avais entendu des bruits singuliers dans les
roseaux qui, à l’endroit où nous étions parvenus, forment un épais
rideau sur le courant de la Source. Le Frère lui-même, étonné et
saisi, s’interrompit. Un peu effrayé, je me rapprochai de lui.
Nous attendîmes, œil braqué, oreille au vent.
Soudain deux têtes passèrent au-dessus des flèches des roseaux,
puis vivement disparurent, puis se remontrèrent pour s’effacer
encore. Je ne pus distinguer aucun visage.
—Viens, fillot, viens, me dit Barnabé à voix basse. Quand les
honnêtes gens s’amusent, il ne faut pas les inquiéter... Ça me
rappelle le bon temps... Au demeurant, tu verras de quoi il s’agit...
Marche doucement.
Quittant le chemin gazonné du bord de l’eau, nous coupâmes à
droite par les rochers.
Je me retournai. Quel spectacle! Le frère Agricol Lambertier, les
deux bras enlacés à la taille de sa Victoire, dansait sur le gazon,
derrière les roseaux, avec une fureur de possédé. Il courait à droite,
à gauche, faisant des pas démesurés avec ses pieds pointus tant il
s’efforçait de les tendre, mais retenant toujours son fardeau qu’il
couvrait de baisers à l’envi. Une fois, il manqua de rouler dans le
ruisseau, ayant d’un seul bond arpenté trop de terrain. Une yeuse se
trouva là, et, d’une main robuste comme un crochet de fer, il se
retint au tronc vigoureusement.
La mythologie m’avait souvent parlé des Nymphes, des Faunes,
des Satyres, des Sylvains, sans que j’entendisse ces personnages
fabuleux; désormais j’avais compris, et, rougissant jusqu’au blanc
des yeux, je m’échappai vers Cavimont.

Pas plus de bruit autour de la chapelle de Notre-Dame qu’autour


du sanctuaire de Sainte-Anne-la-Marieuse. Tout se taisait.
Ce silence imposant—il l’est toujours sur les sommets—me permit
de discerner des paroles qu’on murmurait en l’intérieur de
l’ermitage. J’y courus.
Adon Laborie et Gratien Pastourel, assis sur des escabelles,
devisaient paisiblement à mi-voix. Un petit sac de grosse toile, farci
d’écus, se tenait debout à la droite du frère Adon, et, devant le frère
Gratien, se dressaient des piles de gros sous. Les ermites, tout en
échangeant des paroles brèves, grignotaient des restes de
victuailles, maigre fruit des quêtes qu’ils avaient dû pratiquer parmi
les pèlerins de la Source et des rochers.
Avant que les Frères, préoccupés, se fussent retournés vers moi,
Barnabé parut.
—Eh bien! demanda-t-il, frappant sur l’épaule à Laborie, combien
de rondelles d’argent, cette année?
—Quatre cent cinquante-trois francs huit sous. Notre-Dame a
rendu deux cents francs, Sainte-Anne-la-Marieuse le reste.
Barnabé soupesa le sac.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like