This book presents a first course in Android programming. To start, it shows how to install and configure Android Studio and the Android SDK. Then, it presents a series of complete Android apps that illustrate key skills…working with widgets, layouts, event handling, fragments, services, broadcast receivers, SQLite databases, content providers, Google Maps, and much more!
The only prerequisite for this book is a basic set of Java skills equivalent to chapters 1-16 of Murach's Java Programming.
You are currently on the Murach site for instructors. To buy this book, please visit our retail site.
I like the fact that the book approaches the subject by using example apps as the theme of study, and working through the skills incrementally from easy to difficult. These case-study apps are complete apps by themselves and are worthy of being in the Android app stores.”
This book presents a first course in Android programming. By using realistic Android apps, it engages students, shows them how everything they’re learning can be applied in the real world, and gives them ideas for their own apps.
Here’s a brief rundown on each section of this book.
In just 4 chapters, your students will quickly master the basics of Android programming. That includes:
Next, your students will learn the Android essentials as they enhance the Tip Calculator app that they developed in section 1. That includes:
Here, your students will learn how to develop a News Reader app that displays current news to the user. This will help you teach them:
In this section, you can teach your students how to develop a Task List app that stores one or more to-do lists. Along the way, they’ll learn:
Using this section, you can cover some advanced skills for developing and deploying apps, including:
The only prerequisite is a basic understanding of Java, equivalent to chapters 1-16 of Murach’s Java Programming (5th Edition).
The software that your students need for this book can be downloaded for free from the Internet:
Appendixes A, B, and C in this book show an easy way to install and configure this software on Windows, Mac OS X, and Linux systems.
If necessary, your students can use an emulator to run and test Android apps; this book shows how. Unfortunately, emulators tend to run extremely slowly on most computers. As a result, we recommend that your students use an actual Android device such as a smartphone or tablet whenever possible.
Over 95% of all Android devices use Android 4.0 (API 15) or later, and this book reflects that. The only app that won’t work with Android 4.0 is the News Reader app, which is designed to work with Android 4.1 (API 16) and later.
At the time this book was written, the most recent release was Android 6.0 (API 23). But since Android is backwards-compatible, all of the apps will continue to work under subsequent releases, too.
The software you need for developing Android apps is available for Windows, Mac OS X, and Linux. The appendixes in this book show how to download and install this software on all three of these operating systems.
This book shows you how to use Android Studio to code, test, and debug applications. Android Studio is the official IDE for Android development, so it’s what the professionals use. It’s also available for free, and it runs on all operating systems.
For beginning programming or core Java courses, we offer the latest edition of our longtime favorite, Murach’s Java Programming (5th Edition). It’s designed to deliver the basic Java skills that your students need for Android programming.
For Java web programming courses, we offer Murach’s Java Servlets and JSP (3rd Edition). Like our Android text, it interfaces easily with our core Java text.
“Want to get into Android programming fast and seamlessly? This book is all you need to create an application from scratch and publish it successfully to Google Play Market.”
- Igor Rolinsky, Chicago Java User Group
“As someone who first learnt Android programming from a confusing jumble of resources strewn across the Internet - from Google's tutorials to StackOverflow questions to any number of random blog posts that search threw up - I can honestly say I wish I had read this book first, because it would have saved me an awful amount of time and confusion.
“The book takes the reader along a gentle basics-to-advanced learning path that quite accurately addresses at every step what a new developer should learn next, both on the front end and back end.”
- Karthik Shiraly, CodeRanch
“This book is geared towards folks looking to get a handle on a complex topic. Walking through the chapters, it really presents material in a great fashion. The exercise and homework questions are on point, the writing clear, and the example applications germane and useful. A perfect book for someone who is stuck on the hurdle of ‘where do I start.’”
- Jeremy Johnson, Dream in Code
“Developing Android apps can be really challenging even to seasoned programmers. Much of the challenge has to do with having to make an app work in a very fragmented Android platform. I'm glad that the book makes great effort in highlighting the crucial differences between the API versions and providing best-practice guidance on implementing back-compatibility support.
“Of note is that the book doesn't just leave readers will the essential programming skills but also takes readers through the important app publishing process on Google Play store. This is really end-to-end stuff.
“Taking into consideration the well-structured content, clear and concise writing style, practical code samples and exercises, I think this book serves as an excellent learning tool to those who are getting their feet wet in the world of Android programming or who just want to update their core Android programming skills.”
- Jason Ong, ASPNETWorld
To view the table of contents for this book in a PDF: Table of Contents
Click on any chapter title to display or hide its content.
Types of devices
Types of apps
A brief history
Versions
System architecture
How apps are compiled and run
How to work with the Welcome page
How to open an existing project
How to view the user interface for an app
How to view the code for an app
How to run an app on a physical device
How to run an app on an emulator
The user interface
The user interface
How to create a new project
How to work with a layout
How to add widgets to a layout
How to set the display text
How to work with resource files
How to set properties
Common properties
The XML for the user interface
How to work with an activity
How to remove the v7 appcompat support library
How to get references to widgets
How to handle the EditorAction event
How to get and set the text for widgets
The lifecycle of an activity
How to save and restore values
The Java code for the app
How to work with the Gradle build script
How to work with dependencies
How to work with the Android manifest
How to set the launcher icon for an app
How to use the documentation for the Android API
Typical test phases
How to check the layout
How to handle runtime errors
How to use LogCat
How to use toasts
How to set and remove breakpoints
How to step through code
How to inspect variables
How to inspect the stack trace
How to create an emulator for a tablet
How to create an emulator for a phone with a hard keyboard and DPad
A summary of layouts
A summary of widgets
The View hierarchy
How to use a linear layout
How to use a table layout
How to use a frame layout
How to nest layouts
How to provide a landscape layout
How to use editable text views
How to use check boxes
How to use radio buttons
How to use spinners
How to use seek bars
How to display images
How to show and hide widgets
How to add scroll bars
How to display web content
High-level events
Low-level events
How to use the current class as the listener
How to use a named class as the listener
How to use an anonymous class as the listener
How to use an anonymous inner class as the listener
When to use each technique
How to handle events for check boxes and radio buttons
How to handle events for radio groups
How to handle events for spinners
How to handle events for seek bars
How to handle Key events
How to handle Touch events
The user interface
The Java code for the activity
Three common themes
How to supply different themes for different APIs
How to convert an existing project to the AppCompat theme
How to define a style
How to apply a style
How to create a style sheet
How to modify a built-in theme
How to modify the AppCompat theme
How to modify a theme depending on the API
How to modify the text appearance for a theme
A summary of built-in themes
How to apply themes
How to define colors
How to apply colors
An introduction to menus
How to define a menu
How to display an options menu
How to handle option menu events
How to start a new activity
An introduction to preferences
How to define preferences
How to display preferences
How to get preferences
How to use preferences
How to group preferences
How to enable and disable preferences
How to use Java to work with preferences
Single-pane and multi-pane layouts
The lifecycle methods of a fragment
How to create the layout for a fragment
How to create the class for a fragment
How to display a fragment in an activity
How to create a preference fragment
How to display a preference fragment in an activity
How to add multiple fragments to a layout
How to detect screen width
How to control the soft keyboard
How to get a reference to a fragment
How to replace one fragment with another
The user interface
The XML for an RSS feed
How threads work
How to execute asynchronous tasks
How to execute timed tasks
How to update the UI thread
How to download a file from the Internet
How to parse an XML file
The RSSFeedHandler class
The RSSFeed class
The RSSItem class
How to create the layout for a list view
How to use an adapter to display data in a list view
How to handle events for an adapter
How to pass data between activities
How to view a URL in a web browser
How to dial or call a phone number
The activity_items layout
The ItemsActivity class
The FileIO class
The activity_item layout
The ItemActivity class
How to define the Application object
How to register the Application object
How to use the Application object
The lifecycle of a service
How to create a service
How to register a service
How to start and stop a service
How to use threads with services
How to test a service
How to view all services
How notifications work
How to create a pending intent
How to create a notification
How to display or remove a notification
How to check if a network connection is available
The NewsReaderService class
The ItemsActivity class
The FileIO class
A summary of the system broadcasts
How to code a receiver for the boot completed broadcast
How to code a receiver for the connectivity changed broadcast
How to create and send a custom broadcast
How to code a receiver for a custom broadcast
The user interface for the Task List app
An introduction to SQLite
An introduction to the Task List database
The business objects for the Task List app
How to define the constants for a database
How to define the SQL statements that create a database
How to create or upgrade a database
How to open and close a database connection
How to retrieve multiple rows from a table
How to retrieve a single row from a table
How to get data from a cursor
How to insert, update, and delete rows
How to test the database class
How to clear test data from a device
How to work with the database file
How to use DB Browser for SQLite
How to add the TabManager class to your project
The layout for an activity that displays tabs
The class for an activity that displays tabs
The class for a fragment that displays tab content
A layout for a list view item
A class that extends the layout for a list view item
A class for a custom adapter
A class for a fragment that uses a custom adapter
The user interface
The activity_task_list menu
The TaskListActivity class
The activity_add_edit and spinner_list layout
The activity_add_edit menu
The AddEditActivity class
URIs for content providers
MIME types for content providers
How to add supporting methods to the database class
How to start a content provider class
How to provide for querying
How to provide for inserting rows
How to provide for updating rows
How to provide for deleting rows
How to register a content provider
How to use a custom content provider
How to use a built-in content provider
How to import the dialog class and interface
How to build and show the dialog box
The user interface
The XML for the layouts
The Java code for the activity
A Home screen that has app widgets
How to remove app widgets
How to add app widgets
How to create the layout
How to modify the database class
How to create the provider class
How to configure an app widget
How to register an app widget
How to test an app widget
How distribution works
How monetization works
How to prepare an app for release
How to create the signed APK file
How to distribute via a website
How distribute via email
How to set up a publisher account
How to use the Developer Console to publish an app
How to view the listing for an app
The user interface for the Run Tracker app
An introduction to determining location
An introduction to maps
An introduction to the Google Maps Android API
How to create a new Google Maps project
How to add Google Play services to an existing project
How to get a Google Maps API key
How to set permissions and features
How to connect to Google Play services
How to get the current location
How to handle a failed connection
How to get location updates
How to make sure GPS is enabled
How to add a map fragment to a layout
How to display a map
How to zoom in on a location
How to add markers
How to add lines
The activity_run_map layout
The RunMapActivity class
The RunTrackerService class
If you aren’t already familiar with the supporting courseware that we provide for a book, please go to About our Courseware. As you will see, our courseware consists of the end-of-chapter activities in the book, the files in the student download at our retail site, and the instructor’s materials. These components provide everything that other publishers provide, but in a way that delivers better results.
If you are familiar with our courseware, here’s a quick summary of the courseware for this book. For a detailed description in PDF format, please read the Instructor’s Summary.
In the book, the appendixes give your students complete instructions for downloading and installing these items.
To view the "Frequently Asked Questions" for this book in a PDF, just click on this link: View the questions
Then, if you have any questions that aren't answered here, please email us. Thanks!
To view the corrections for this book in a PDF, just click on this link: View the corrections
Then, if you find any other errors, please email us so we can correct them in the next printing of the book. Thank you!
This is our site for college instructors. To buy Murach books, please visit our retail site.