Kotlin and Android Development featuring Jetpack
Build Better, Safer Android Apps
by Michael Fazio
Version: P1.0 (June 2021)
Copyright 2021 The Pragmatic Programmers, LLC. This book is licensed to the individual who purchased it. We don't copy-protect it because that would limit your ability to use it for your own purposes. Please don't break this trustyou can use this across all of your devices but please do not share this copy with other members of your team, with friends, or via file sharing services. Thanks.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g device are trademarks of The Pragmatic Programmers, LLC.
Every precaution was taken in the preparation of this book. However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein.
About the Pragmatic Bookshelf
The Pragmatic Bookshelf is an agile publishing company. Were here because we want to improve the lives of developers. We do this by creating timely, practical titles, written by programmers for programmers.
Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun. For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com.
Our ebooks do not contain any Digital Restrictions Management, and have always been DRM-free. We pioneered the beta book concept, where you can purchase and read a book while its still being written, and provide feedback to the author to help make a better book for everyone. Free resources for all purchasers include source code downloads (if applicable), errata and discussion forums, all available on the book's home page at pragprog.com. Were here to make your life easier.
New Book Announcements
Want to keep up on our latest titles and announcements, and occasional special offers? Just create an account on pragprog.com (an email address and a password is all it takes) and select the checkbox to receive newsletters. You can also follow us on twitter as @pragprog.
About Ebook Formats
If you buy directly from pragprog.com, you get ebooks in all available formats for one price. You can synch your ebooks amongst all your devices (including iPhone/iPad, Android, laptops, etc.) via Dropbox. You get free updates for the life of the edition. And, of course, you can always come back and re-download your books when needed. Ebooks bought from the Amazon Kindle store are subject to Amazon's polices. Limitations in Amazon's file format may cause ebooks to display differently on different devices. For more information, please see our FAQ at pragprog.com/#about-ebooks. To learn more about this book and access the free resources, go to https://pragprog.com/book/mfjetpack, the book's homepage.
Thanks for your continued support,
Andy Hunt
The Pragmatic Programmers
The team that produced this book includes: Dave Rankin (CEO) Janet Furlow (COO) Tammy Coron (Managing Editor) Michael Swaine (Development Editor) Sakhi MacMillan (Copy Editor) Potomac Indexing, LLC (Indexing) Gilson Graphics (Layout) Andy Hunt and Dave Thomas (Founders)
For customer support, please contact .
For international rights, please contact .
Table of Contents
Copyright 2021, The Pragmatic Bookshelf.
Early Praise for Kotlin and Android Development featuring Jetpack
Learning a new language and platform at the same time can seem daunting, but this book makes it both fun and easily understandable. The sample apps make complex topics such as view binding and unit testing relatable and easy to understand.
Markus Neuhoff |
Android/Kotlin Course Author, Pluralsight |
Michael does an excellent job explaining Kotlin, from the basics to the most advanced topics. The two example applications are incredibly helpful for both beginners and advanced developers. Coming from a different background in mobile development, having the step-by-step on the basics on how to use Android Studio and following the examples in the book made it easy to focus on the important topic, which is learning Kotlin.
Pablo Siller |
Mobile Lead, Trek Bicycle |
If youre serious about developing Android applications with Kotlin, youve found a thorough and yet an approachable book that will guide you through every step of developing and testing.
Dr. Venkat Subramaniam |
Founder, Agile Developer, Inc. |
A great walkthrough of using Kotlin for Android development. Plenty of code examples and a clear trajectory from beginner to advanced.
Greg Levenhagen |
Principal Consultant, MS Regional Director, MS AI MVP, Skyline Technologies, Inc. |
Whether youre new to or have experience with Kotlin, this book is a valuable resource. With great project-based examples, youll easily be able to adapt what you learn to your own projects. This is a must-have for any developers collection.
Rolando Lopez |
Senior Mobile Applications Developer, Milwaukee Tool |
As someone that has no Android-development experience, but a strong software development background, I found this to be a very engaging and informative first step into the world of Android. Highly recommended for anyone looking to get into this world!
Brandon Martinez |
Senior Service Engineer, Microsoft |
Acknowledgments
First off, a big thank you to the entire Pragmatic Bookshelf team, and especially three particular people. I want to express a great deal of gratitude to my editor, Michael Swaine, for taking this journey with me, supporting me at each step of the process, and sometimes just giving me the Youre all good, dont worry that really I needed. This book would never have been a possibility without Brian MacDonald coming up to me at THAT Conference and saying Hey, do you want to write a book on Kotlin?, then working with me through the entire pre-book process. And finally Brian Hogan, who assured me that PragProg was great (turns out they are) and that I could actually do this book (turns out I could).
My sincere appreciation to my tech reviewers: Joe Vetta, Rolando Lopez, Ben Gavin, Brandon Martinez, and Andrew Petersen. The fact that you all took the time to read through my book and help make it better means so much to me, and Im eternally grateful for that. Also, thank you to Keno Basedow for finding a number of ways I could improve the book and make it clearer during the beta process.
Ive been lucky enough to have support from everyone around me. This includes the whole Skyline crew, who have been great with this crazy side project of mine. Craig and Joe, for tolerating my incessant OMG KOTLIN comments the past few years. Rolando, for being as excited as anyone when I found out the book was happening. And all my friends and family who knowingly (or unknowingly) are part of the book in the Android Baseball League.