HOUR 4: Activities and Fragments
HOUR 5: Responsive Apps: Running in the Background
Part II: Creating the User Interface
HOUR 6: Using Basic UI Controls
HOUR 7: Using Layouts
HOUR 8: ListViews and Adapters
HOUR 9: Material Design
HOUR 10: More Views and Controls
HOUR 11: ImageViews and Bitmaps
HOUR 12: Using VideoViews and Media
HOUR 13: Adding Navigation
Part III: Working with Data
HOUR 14: Using the File System
HOUR 15: Using SharedPreferences
HOUR 16: Using SQLite and File Storage
HOUR 17: Accessing the Cloud: Working with a Remote API
HOUR 18: Introducing Content Providers
HOUR 19: Creating a Content Provider
HOUR 20: Loaders and CursorAdapters
Part IV: Next Steps
HOUR 21: Using Notifications
HOUR 22: Android TV and Wear Apps
HOUR 23: More Features to Explore
HOUR 24: Publishing Your Apps
What I wish I knew when I started Android development....
Android has become a leading platform for smartphones, tablets, and other devices. The goal of this book is to introduce the Android platform and start you on the path to creating professional-grade apps.
In 24 hours of topic-based material, you learn the concepts of Android development and move on to specific topics like working with data in the cloud, handling bitmaps and videos in an app, and using new features (such as
CardView in the Lollipop versions of Android). The coverage of material design and Lollipop features will take you far. The Lollipop version of Android will give way to Android M in the future. Android M will focus on performance improvements.
In the early days of Android, author Carmen Delessio worked on a significant Android project for a large media company. The app launched and was a success. But, it could have been built in a more “Android way.” With the authors having built many Android apps since then, the material in this book is largely guided by the idea of including “what I wish I knew then.”
This book is not intended to be an encyclopedia of all things Android. Plenty of Android resources are available, and the documentation on the Android developer site has never been better. This book starts you on the path to developing professional Android apps and can be used as a guide to the additional material.
There are two major changes from the third edition to the fourth edition of this book.
New features in Android are covered. The updates include significant coverage of material design, including
CardView. New notification features are covered. An introduction to Android Wear and Android TV is included. Significantly, this edition uses Android Studio throughout rather than Eclipse. All development screenshots and examples use Android Studio.
The second change is this book starts by covering four important components of Android. In the first hour, you learn about activities, intents, intent services, and broadcast receivers. Subsequent hours drill more deeply into these broad concepts. This change highlights what is happening when an app runs and puts even more emphasis on doing things the “Android way.”
The examples in this book are created so that someone with programming knowledge can understand them, but Android apps are developed in Java. You will find the book much more valuable and useful if you are familiar with Java concepts and syntax. If you are knowledgeable in C or C# and understand object-oriented concepts, you should be able to understand the level of Java code in this book. You should know what classes and methods are.
If you are a Java programmer with an interest in Android development, this book introduces you to Android and gets you on track for professional Android development.
If you have started Android development, but have not proceeded past the basic examples, this book is for you. It covers topics such as downloading data, using a database, and creating content providers. This book can take you from the basics to real development in a series of understandable steps.
The book is organized into four broad sections:
Part I, “Android Fundamentals.” This first part introduces Android concepts and uses examples to show how to start activities, pass data, and handle core functionality. It covers activities, intents, resources, and background processing.
Part II, “Creating the User Interface.” When you create the user interface, you learn about components and layouts. You cover bitmaps and video views. You also learn about navigation within an app, and you cover material design—the new design from Google that is used in Android.
Part III, “Working with Data.” Working with data means both retrieving data over a network and storing it. You learn about using a SQLite database and using content providers.
Part IV, “Next Steps.” This last part covers other features to investigate further, open source projects of interest, and how to publish your app.
You can find online updates, contact the author, and ask questions about this book on http://talkingandroid.com/. Links to source code are posted there.
Nearly every chapter in this book includes an example that has source code available online. The code is on GitHub and organized by chapter. You will find the code here: https://github.com/CarmenDelessio. Code for an individual chapter should be easy to find. For example, the complete project code for Hour 10 is here: https://github.com/CarmenDelessio/Hour10application.
“This latest edition of Sams Teach Yourself Android Application Development in 24 Hours is just what you’ve been waiting for if you’ve been waiting to get into Android development. Freshly updated with what you need to know for developing applications using Android Studio for Android Lollipop (Android 5) with Material Design, this book covers what you need to know to get started building applications for Android.”
—Ray Rischpater, Author and Engineering Manager at Microsoft
“The new edition of Sams Teach Yourself Android Application Development in 24 Hours covers a lot of new features. The book takes you from the beginning through to uploading your own app into the store. All the screen shots in this edition use the new and official Android IDE (the amazing Android Studio IDE).”
—Fady A. M. Ibrahim, Android Instructor, Benha Faculty of Computer and Information
“Any developer who wants to get up to speed quickly on Android will appreciate this introduction. Beyond the SDK fundamentals, there’s plenty of good information on the things real-world Android apps are made of, such as maps, images, and navigation. This is a great way to dive head-first into Android development, or just to become Android-literate in record time.”
—Jonathan Taylor, VP, Mobile Technology, Priceline.com
The authors knock it out of the park for new Android developers and experienced ones who want to extend their prowess. This book is perfectly set-up for a sports technology oriented person like me to teach me the basic principles, give me design knowledge, and then cap that off with how to add and manipulate data. Data-driven applications are the life’s blood of every fantasy sports player and the authors’ ability to break down the path to success with real-life exercises to put these principles into action is a Grand Slam!”
—Rick Wolf, President, Fantasy Alarm, and Co-Founder, Fantasy Sports Trade Association
Carmen Delessio is an experienced application developer who has worked as a developer, technical architect, and CTO in large and small organizations. Carmen began his online development career at Prodigy, where he worked on early Internet applications, shopping apps, and fantasy baseball. He is a graduate of Manhattanville College and lives in Pound Ridge, New York, with his wife, Amy, and daughter, Natalie.
Lauren Darcey is responsible for the technical leadership and direction of a small software company specializing in mobile technologies, including Android and iOS consulting services. With more than two decades of experience in professional software production, Lauren is a recognized authority in application architecture and the development of commercial-grade mobile applications. Lauren received a BS in computer science from the University of California, Santa Cruz.
Shane Conder has extensive application development experience and has focused his attention on mobile and embedded development for well over a decade. He has designed and developed many commercial applications for Android, iOS, BREW, BlackBerry, J2ME, Palm, and Windows Mobile—some of which have been installed on millions of phones worldwide. Shane has written extensively about the tech industry and is known for his keen insights regarding mobile development platform trends. Shane received a BS in computer science from the University of California, Santa Cruz.
For ASL and NMLD.
“To the Valiant of heart, nothing is impossible.” – Jeanne d’Albret
This book would not exist without the help and guidance of the team at Pearson (Sams Publishing). Thanks to Laura Lewin for constant encouragement and Olivia Basegio for her incredible work on the project. Sheri Cain helped take this book to another level with her feedback. Her diligence and hard work kept this project constantly moving forward.
Technical editors are an important part of every book. Ray Rischpater was an incredible help. Valerie Shipbaugh did her technical review by placing herself in the role of a reader who was new to Android. The feedback and guidance from Ray and Valerie make this a better book.
As the reader of this book, you are our most important critic and commentator. We value your opinion and want to know what we’re doing right, what we could do better, what areas you’d like to see us publish in, and any other words of wisdom you’re willing to pass our way.
We welcome your comments. You can email or write directly to let us know what you did or didn’t like about this book—as well as what we can do to make our books better.
Please note that we cannot help you with technical problems related to the topic of this book.
When you write, please be sure to include this book’s title and author as well as your name and email address. We will carefully review your comments and share them with the author and editors who worked on the book.
Mail: Reader Feedback
800 East 96th Street
Indianapolis, IN 46240 USA
Visit our website and register this book at http://www.informit.com/register for convenient access to any updates, downloads, or errata that might be available for this book.