Build exceptional Android applications and wearables with concise guided recipes and support the new foldable technology by using the latest Jetpack libraries Purchase of the print or Kindle book includes a free PDF eBook Key Features: Leverage the power of the latest Jetpack libraries in your day-to-day Android development tasks Explore Wear OS and build large screens to support the foldable world using the declarative approach Write tests and debug your code as you discover the most useful tips, tricks, and best practices Book Description: Android is a powerful operating system widely used in various devices, phones, TVs, wearables, automobiles, and more. This Android cookbook will teach you how to leverage the latest Android development technologies for creating incredible applications while making effective use of popular Jetpack libraries. You'll also learn which critical principles to consider when developing Android apps. The book begins with recipes to get you started with the declarative UI framework, Jetpack Compose, and help you with handling UI states, Navigation, Hilt, Room, Wear OS, and more as you learn what's new in modern Android development. Subsequent chapters will focus on developing apps for large screens, leveraging Jetpack's WorkManager, managing graphic user interface alerts, and tips and tricks within Android studio. Throughout the book, you'll also see testing being implemented for enhancing Android development, and gain insights into harnessing the integrated development environment of Android studio. Finally, you'll discover best practices for robust modern app development. By the end of this book, you'll be able to build an Android application using the Kotlin programming language and the newest modern Android development technologies, resulting in highly efficient applications. What You Will Learn: Use Kotlin programming to build your Android applications Leverage modern Android development (MAD) libraries to create exceptional apps Explore modern app architecture concepts such as model-view-viewmodel (MVVM) Utilize dependency injection, clean architecture, and module organization Discover how to write UI and unit tests for your applications Get to grips with paging, data binding, and datastore Build large screens to support the new foldable world Explore principles of Wear OS in modern Android development Who this book is for: This book is for active junior-to-mid-level Android developers with one to two years of professional experience in developing Android applications who are interested in advancing their knowledge of Android development. The recipes in this book use Kotlin and not Java.
Author(s): Madona S. Wambua
Edition: 1
Publisher: Packt Publishing
Year: 2023
Language: English
Pages: 322
Cover
Title page
Copyright and credits
Contributors
Table of Contents
Preface
Chapter 1: Getting Started with Modern Android Development Skills
Technical requirements
Writing your first program in Kotlin using variables and idioms
Getting ready
How to do it…
How it works…
See also
Creating a Hello, Android Community app using Android Studio
Getting ready
How to do it…
How it works…
Setting up your emulator in Android Studio
Getting ready
How to do it…
How it works…
Creating a button in Jetpack Compose
Getting ready
How to do it…
How it works…
There’s more…
Utilizing gradlew commands to clean and run your project in Android Studio
Getting ready
How to do it…
How it works
See also
Understanding the Android project structure
Getting ready
How to do it…
How it works…
Debugging and logging in Android Studio
Getting ready
How to do it…
How it works…
See also
Chapter 2: Creating Screens Using a Declarative UI and Exploring Compose Principles
Technical requirements
Implementing Android views in Jetpack Compose
Getting ready
How to do it…
How it works…
Implementing a scrollable list in Jetpack Compose
Getting ready
How to do it…
How it works…
See also
Implementing your first tab layout with a view pager using Jetpack Compose
Getting ready
How to do it…
How it works…
Implementing animations in Compose
Getting ready
How to do it…
How it works…
Implementing accessibility in Jetpack Compose
Getting ready
How to do it…
How it works…
There’s more…
Implementing declarative graphics using Jetpack Compose
Getting ready
How to do it…
How it works…
There’s more…
Chapter 3: Handling the UI State in Jetpack Compose and Using Hilt
Technical requirements
Implementing DI with Jetpack Hilt
Getting ready
How to do it…
How it works…
Implementing ViewModel classes and understanding the state in Compose
Getting ready
How to do it…
How it works…
See also…
Implementing Compose in an existing XML layout-based project
Getting ready
How to do it…
How it works…
Understanding and handling recomposition in Jetpack Compose
How to do it…
How it works…
See also
Writing UI tests for your Compose views
Getting ready
How to do it…
How it works…
There’s more…
Writing tests for your ViewModels
Getting ready
How to do it…
How it works…
Chapter 4: Navigation in Modern Android Development
Technical requirements
Implementing a bottom navigation bar using navigation destinations
Getting ready
How to do it…
How it works…
Navigating to a new screen in Compose
Getting ready
How to do it…
How it works…
See also
Navigating with arguments
Getting ready
How to do it…
How it works…
There’s more…
Creating deep links for destinations
Getting ready
How to do it…
How it works…
There’s more…
Writing tests for navigation
Getting ready
How to do it…
How it works…
Chapter 5: Using DataStore to Store Data and Testing
Technical requirements
Implementing DataStore
How to do it…
How it works…
Adding Dependency Injection to DataStore
How to do it…
How it works…
There’s more…
See also
Using Android Proto DataStore versus DataStore
Getting ready
How to do it…
How it works…
See also
Handling data migration with DataStore
Getting ready
How to do it…
How it works…
Writing tests for our DataStore instance
How to do it…
How it works…
See also
Chapter 6: Using the Room Database and Testing
Technical requirements
Implementing Room in your applications
How to do it…
How it works…
Implementing Dependency Injection in Room
Getting ready
How to do it…
How it works…
See also
Supporting multiple entities in Room
Getting ready
How to do it …
How it works…
There’s more...
Migrating an existing SQL database to room
How to do it…
How it works…
Testing your local database
Getting ready
How to do it…
How it works…
Chapter 7: Getting Started with WorkManager, a Jetpack Library
Technical requirements
Understanding the Jetpack WorkManager library
Getting ready
How to do it…
How it works…
There’s more…
Understanding WorkManager state
How to do it…
How it works…
Understanding threading in WorkManager
Getting ready
How to do it…
How it works…
See also
Understanding chaining and canceling work requests
Getting ready
How to do it…
How it works…
See also
Implementing migration from Firebase JobDispatcher to the new recommended WorkManager
Getting ready
How to do it…
How it works…
How to debug WorkManager
Getting ready
How to do it…
How it works…
Testing Worker implementations
Getting ready
How to do it…
How it works…
There’s more…
Chapter 8: Getting Started with Paging a Jetpack Library
Technical requirements
Implementing the Jetpack Paging library
Getting ready
How to do it…
How it works…
Managing present and loading states
Getting ready
How to do it…
How it works…
There’s more…
Implementing your custom pagination in Jetpack Compose
Getting ready
How to do it…
How it works…
Loading and displaying paged data
How to do it…
How it works…
Understanding how to transform data streams
Getting ready
How to do it…
How it works…
See also
Migrating to Paging 3 and understanding the benefits
Getting ready
How to do it…
How it works…
Writing tests for your Paging Source
Getting ready
How to do it…
How it works…
Chapter 9: Building for Large Screens
Technical requirements
Building adaptive layouts in Modern Android Development
Getting ready
How to do it…
How it works…
Building adaptive layouts using ConstraintLayouts
Getting ready
How to do it…
How it works…
Handling large-screen configuration changes and continuity
Getting ready
How to do it…
How it works…
Understanding activity embedding
Getting ready
How to do it…
How it works…
Material Theming in Compose
Getting ready
How to do it…
How it works…
See also…
Testing your applications on a foldable device
Getting ready
How to do it…
How it works…
Chapter 10: Implementing Your First Wear OS Using Jetpack Compose
Technical requirements
Getting started with your first Wear OS in Android Studio
Getting ready
How to do it…
How it works…
Creating your first button
Getting ready
How to do it…
How it works…
Implementing a scrollable list
Getting ready
How to do it…
How it works…
Implementing Cards in Wear OS (TitleCard and AppCard)
Getting ready
How to do it…
How it works…
Implementing a chip and a toggle chip
Getting ready
How to do it…
How it works…
Implementing ScalingLazyColumn to showcase your content
Getting ready
How to do it…
How it works…
Chapter 11: GUI Alerts – What’s New in Menus, Dialog, Toast, Snackbars, and More in Modern Android Development
Technical requirements
Creating and displaying a menu in Modern Android Development
Getting ready
How to do it…
How it works…
Implementing a Toast/Snackbar to alert users
Getting ready
How to do it…
How it works…
Creating an alert dialog
Getting ready
How to do it…
How it works…
Creating a bottom sheet dialog
Getting ready
How to do it…
How it works…
There is more…
Creating a radio button
Getting ready
How to do it…
How it works…
Creating a FAB/extended FAB
Getting ready
How to do it…
How it works…
There more …
Chapter 12: Android Studio Tips and Tricks to Help You during Development
Technical requirements
The importance of profiling your Android applications
Getting ready
How to do it…
How it works…
See more…
Quick Android shortcuts to make your development faster
Getting ready
How to do it…
How it works…
JetBrains Toolbox and essential plugins to know
Getting ready
How to do it…
How it works…
Debugging your code
Getting ready
How to do it…
How it works…
How to extract methods and method parameters
Getting ready
How to do it…
How it works…
Understanding Git essentials
Getting ready
How to do it…
How it works…
Index
Other Books You May Enjoy