roller  Processing...
Shroff Publishers & Distributors Pvt. Ltd.
Login
 
 
|
Books Expand/Collapse
Skip Navigation Links.
.Net Platform
3D Computer Graphics
ABAP Programming
Academics
ACCA (Association of Chartered Certified Accountants)
Accounting
ActionScript
Active Server Pages (ASP)
Administration
ADO .NET
Adobe
Adobe Acrobat
Adobe Indesign
Adobe Photoshop
Aeronautical Engineering & Aircraft Maintenance
Aeronautics
Agile Testing
AIEEE
Ajax
Algebra
Algorithms
Amazon
Android
Animation
ANSI
Apache
Apple
Apple Mobile
Application Development
Application Program Interface
Application Software
Applications
Architecture
Architecture & Analysis
Arduino
Artificial Intelligence
Arts & Photography
AS/400
ASP.NET
Assembly Language Programming
Astronomy
Audio Books
Autocad
Aviation
Aviation Weather
Banking
Beginners Level
Biographies & Memoirs
Biography
Bioinformatics
Biological Terrorism
Biology
Biotechnology Engineering
Body, Mind & Spirit
Book Publishing
BPEL (Business Process Execution Language)
Brand Management
Buddhism
Business
Business & Economics
Business & Investing
Business & Money
Business Application
Business Communications
Business Governance
Business Intelligence
Business Management
Business Process
Business Skills
Business Software
Business, Management & Finance
C & C++
C Programming
C# / Visual C# .Net
C++ Programming
C/ C++/ C#
CADD
Career
Career Development
Career Guides
Catering & Hotel Management
Certification
Chartered Accountancy
Chemical Engineering
Chemistry
CIA
CICS
CIMA (Chartered Institute of Management Accountants)
CISA
Cisco / Brocade
CISSP
Civil Aviation Requirement
Civil Engineering
Civil Services Aptitude Test (CSAT)
Client/Server
Clothing
Cloud Computing
Cloud Programming
CMMI (Capability Maturity Model Integration)
Cobol
Coldfusion
COM / DCOM / COM+
Communications
Competitive Examination
Complete Study Text
Complete Text
Computer Architecture
Computer Games
Computer Graphics
Computer Programming
Computer Science
Computer Security
Computer Vision
Computers
Computers & Internet
Computers & Technology
Computing
Configuration Management Software
Consumer Behaviour
Content Management System (CMS)
Cookbooks
CPIM
CQA
Crafts & Hobbies
Criminology
Crystal Reports
CSS (Cascading Style Sheets)
Current Affairs
Customer Relationship Management (CRM)
Data
Data Analysis
Data Modeling
Data Modeling & Design
Data Science
Data Warehousing
Database Management
Database Programming
Databases
Databases & Big Data
DB2
Decorative Arts & Design
Defence
Dental
Design
Designing with Data
Desktop Publishing (Macintosh & Windows)
DHTML
Digital Audio
Digital Media
Digital Photography
Digital Video
Distributed Computing
DIY Projects
DNS
Drafting
Dreamweaver Ultradev / Dreamweaver MX / Dreamweaver CS
Drupal
E- Commerce
E-Commerce
E-Learning
Eclipse
Economics
Education & Reference
Educational
Electrical Engineering
Electronic Project
Electronics
Electronics Engineering
ELT & Dictionary
Email
Embedded Systems
Engineering
Engineering & Transportation
English
English Language Teaching
Enterprise
Enterprise JavaBeans (EJB)
Enterprise Products and Platforms
Enterprise Service Bus (ESB)
Entrepreneurship
Environment
Environmental Studies
Ergonomic
ERP (Enterprise Resource Planning)
Exam Kit
Exam Preparation
Experiments & Projects
F#
Family & Relationships - Parenting
FAQ (Frequently Asked Questions)
Fashion Design
Fashion Technology
Fiction
Filemaker Pro
Finance
Financial Accounting
Financial Applications
Financial Management
Financial Operations
Financial Strategy
Flash
Flex
Flight
Food Recipes
Foreign Exchange
Forensics
French
Functional Programming
Game Development
Game Programming
Games & Strategy Guides
General
General Computing
Geographical Information Systems (GIS)
Geometry
Globalization
GMAT (Graduate Management Admission Test)
GNU
Google
Google Android
Graph Theory
Graphics
Graphics & Design
Graphics Design
Graphics Programming
GRE (Graduate Record Examination)
Green Computing
Hacking
Hardware
Hardware & DIY
Haskell
Health
Health & Fitness - Healing
Health IT
Health, Mind & Body
Hedge Funds
Hibernate
History
Hive
Hobbies
Home Improvement & Design
Hospitality
Hospitality Management
Hotel Management
HRD
HTML
HTML5
Human Resource Management
Human Resource Management Systems (HRMS)
IBM
IBM Content Navigator
IBM Mainframe
IBM Technical Resources
IBM WebSphere
IIT-JEE
Image Processing
IMAP (Internet Message Access Protocol)
Industrial Design
Industrial Engineering
Information Management
Information Management Software
Information Security
Information Technology
Information Theory
Infrastructure Solutions
Innovation Management
Inspirational
Insurance
Integration Software
Interactive Text
Interior Design
International Business
International Developemnt
International Trade
Internet
Internet & Digital Media
Internet & Web
Internet Advertising
Internet Programming
Internet Protocol
Internet Security
Introducing to Computers
Inventions
Investments
iOS Programming
iPad
iPhone
iPod
Islamic Finance
IT Management
ITIL
Jakarta Commons
Jakarta Struts
Java
Java 2 Enterprise Edition (J2EE)
Java Certification
Java Programming
Java Server Programming
JavaScript
JavaServer Faces (JSF)
JavaServer Pages (JSP)
JBoss
JDBC
Jini
Joomla!
Journalism
jQuery
Laboratory
labour
LAN (Local Area Network)
Language
Law
LDAP
Leadership
Learning Disability
Linux
Liquor
Literature
Logistics
Lotus Notes & Domino
Mac
Mac OS
Machine Learning
Macintosh
Main Exams
Management
Management Information System (MIS)
Marine
Marine Engineering
Marketing
Marketing Management
Mathematical & Statistical Software
Mathematics
Matlab
Maya
MCSA / MCSE / MCSD
Mechanical Engineering
Media
Medical
Microcontrollers
Microfinance
Microservices
Microsoft
Microsoft .Net Framework
Microsoft Access
Microsoft Certification
Microsoft Development
Microsoft Dynamics
Microsoft Excel
Microsoft Frontpage
Microsoft Office
Microsoft PowerPoint
Microsoft Programming
Microsoft Project
Microsoft Sharepoint
Microsoft Silverlight
Microsoft SQL Server
Microsoft Visual Basic
Microsoft Windows
Microsoft Word
Missing Manual
Mobile Computing
Mobile Development
Mobile Device
Mobile Enterprise
Mobile Programming
Mobile Security
Moodle
Motivational
Mulitmedia Development
Multimedia
Multithreaded
Murach
Musical Instruments
MySQL
Negotiating
Network
Network Administration
Networking
Networking & Cloud Computing
New Age
Non Fiction
NTSE
Nursing
Object Technology
Object-Oriented Programming
Office
Office Application
Online Marketing
OOP
Open Source
Open Source Programming
OpenGL Programming
Operating Systems
Operation Management
Operations Management
Oracle
Organization Development
Organizational Behavior
Organizational Management
Patent and Trademarks
Patterns
PC Hardware
PeopleSoft
Performance
Perl
Personal Computers
Personal Growth
Pharmacology
Philosophy
Photography
PHP
Physics
PMI-ACP Exam
PMP
Pocket Notes
Political Science
Politics & Government
Postfix
Practice & Revision Kit
Presentation Software
Product Design
Professionals
Programming
Programming & Software Development
Programming Languages
Programming Tools
Project Book
Project Management
PSAT/NMSQT
Psychology
Python
Quality
Quality Management
Quick Test Professional (QTP)
R Languages
Rails
Raspberry Pi
RDF
Real Estate/Home Buying Guides
Recipes
Reference
Relationship Marketing
Religion & Spirituality
Research Methods in Management
Revision Cards
RFID (Radio Frequency Identification)
Risk Management
Risk Management & Insurance
Robotics
Rockets
RPG (Report Program Generator)
RSS (Rich Site Summary)
Ruby
Sales and Distribution
Sales Management
Samba
SAP
SAP At Special Price
SAS
SAT (Scholastic Aptitude Test)
Science
Science & Math
Sciences, Technology & Medicine
Search Engine Marketing
Search Engine Optimization (SEO)
Security
Self-Help
Sendmail
SharePoint
Skills
SOA: Service-Oriented Architecture
SOAP
Social Aspects
Social Media
Social Networking
Social Sciences
Social Web
Software
Software Architecture
Software Design
Software Development
Software Documentation
Software Engineering
Software Project
Software Testing
Solaris
Special Discounts
Special Price
Spiritual
Sports
Spreadsheet
Spring
SQL
Statistics
Statistics Programming
Stock Market
Strategic Management
Structural Analysis & Design
Study Aids
Study Guide
Success
Supply Chain Management
Sybase
System Administration
System Programming
Systems Analysis & Design
TCP/IP
Tech Culture
Technical Writing
Technology
Technology & Engineering
Telecommunications
Telephony
Test Preparation
Text Processing
Textbooks
Time Management
Tivoli
TOEFL (Test of English as a Foreign Language)
Tomcat
Trade Business
Transportation
Travel and Tourism Management
UML (Unified Modeling Language)
Unix
Unix Programming
Unix System Administration
Unix Text Editing
Unix Utilities
Usability
Used Books
User Experience
User Interface Design
UX (User experience)
Valuation
VBA
VBScript
View Engine
Virtualization
Virtualization and Cloud
Visual Basic
Visual Basic .Net / VB .NET
Visual Basic Certification
Visual Basic Programming
Visual C++
Visual Studio .Net
Vmware
Vocational
VoIP
VPN (Virtual Private Networks)
WAP
Wearables
Web
Web Analytics
Web Application
Web Application Framework
Web Applications Testing
Web Authoring
Web Authoring & Design
Web Design
Web Development
Web Development & Design
Web Graphics & Video
Web Marketing
Web Programming
Web Publishing
Web Security
Web Server
Web Services
WebLogic
Website Optimization
WebSphere
Windows
Windows 2000
Windows 7
Windows 8
Windows 95
Windows Administration
Windows Applications
Windows Forms
Windows NT
Windows NT Administration
Windows Programming
Windows Server
Windows Server 2003
Windows Vista
Windows XP
Wireless
Women Empowerment
WordPress
Workplace Culture
World Wide Web
X Windows
XHTML
XML (Extensible Markup Language)
XSL
XSLT
Yoga
Titles By Year Expand/Collapse
Product Details
Books » Software Development
Head First Android Development
Head First Android Development
A Brain-Friendly Guide
By David Griffiths, Dawn Griffiths
|
ISBN: 9789352131341
Paperback
Pages: 760
Size: 8 X 9.25
Shroff/O'Reilly (2015)
Arrival Date: July 11, 2015
List Price: Rs 850.00
Net Price: Rs 644.00    You save 24.24%
Usually shipped in 1-2 days

Add to cart    Add to wishlist
Description Table of Contents
What will you learn from this book?

If you have an idea for a killer Android app, this book will help you build your first working application in a jiffy. You’ll learn hands-on how to structure your app, design interfaces, create a database, make your app work on various smartphones and tablets, and much more. It’s like having an experienced Android developer sitting right next to you! All you need is some Java know-how to get started.

Why does this book look so different?

Based on the latest research in cognitive science and learning theory, Head First Android Development uses a visually rich format to engage your mind, rather than a text-heavy approach that puts you to sleep. Why waste your time struggling with new concepts? This multi-sensory learning experience is designed for the way your brain really works.

About the Authors
Dawn Griffiths started life as a mathematician at a top UK university where she was awarded a First-Class Honours degree in Mathematics. She went on to pursue a career in software development, and has over 15 years experience working in the IT industry. Dawn has written several books, including Head First C, Head First Statistics and Head First 2D Geometry.

David Griffiths began programming at age 12, after being inspired by a documentary on the work of Seymour Papert. At age 15 he wrote an implementation of Papert's computer language LOGO. After studying Pure Mathematics at University, he began writing code for computers and magazine articles for humans and he is currently an agile coach with Exoftware in the UK, helping people to create simpler, more valuable software. He spends his free time traveling and time with his lovely wife, Dawn.
Chapter 1. Getting Started: Diving In
Welcome to Androidville
The Android platform dissected
Here’s what we’re going to do
Your development environment
Install Java
Build a basic app
Let’s build the basic app
Activities and layouts from 50,000 feet
Building a basic app (continued)
Building a basic app (continued)
You’ve just created your first Android app
Android Studio creates a complete folder structure for you
Useful files in your project
Edit code with the Android Studio editors
Run the app in the Android emulator
Creating an Android Virtual Device
Run the app in the emulator
You can watch progress in the console
Test drive
What just happened?
Refining the app
What’s in the layout?
activity_main.xml has two elements
The layout file contains a reference to a string, not the string itself
Let’s look in the strings.xml file
Take the app for a test drive
Your Android Toolbox

Chapter 2. Building Interactive Apps: Apps That Do Something
You’re going to build a Beer Adviser app
Here’s what you need to do
Create the project
We’ve created a default activity and layout
Adding components with the design editor
activity_find_beer.xml has a new button
A closer look at the layout code
Changes to the XML...
...are reflected in the design editor
Use string resources rather than hardcoding the text
Change the layout to use the string resources
Let’s take the app for a test drive
Add values to the spinner
Get the spinner to reference a string-array
Test drive the spinner
We need to make the button do something
Make the button call a method
What activity code looks like
Add an onClickFindBeer() method to the activity
onClickFindBeer() needs to do something
Once you have a View, you can access its methods
Update the activity code
The first version of the activity
What the code does
Test drive the changes
Building the custom Java class
Enhance the activity to call the custom Java class so that we can get REAL advice
Activity code version 2
What happens when you run the code
Test drive your app
Your Android Toolbox

Chapter 3. Multiple Activities and Intents: State Your Intent
Apps can contain more than one activity
Here’s the app structure
Create the project
Update the layout
Update strings.xml...
Create the second activity and layout
What just happened?
Welcome to the Android manifest file
Every activity needs to be declared
An intent is a type of message
Use an intent to start the second activity
What happens when you run the app
The story continues...
Test drive the app
Pass text to a second activity
Update the text view properties
putExtra() puts extra information in an intent
Update the CreateMessageActivity code
Get ReceiveMessageActivity to use the information in the intent
What happens when the user clicks the Send Message button
Test drive the app
We can change the app to send messages to other people
How Android apps work
But we don’t know what apps are on the device
Create an intent that specifies an action
Change the intent to use an action
What happens when the code runs
The story continues...
The intent filter tells Android which activities can handle which actions
How Android uses the intent filter
You need to run your app on a REAL device
Test drive the app
What if you ALWAYS want your users to choose an activity?
What happens when you call createChooser()
The story continues...
Change the code to create a chooser
Test drive the app
If you have NO matching activities
Your Android Toolbox

Chapter 4. The Activity Lifecycle: Being an Activity
How do activities really work?
The Stopwatch app
The stopwatch layout code
How the activity code will work
Add code for the buttons
The runTimer() method
Handlers allow you to schedule code
The full runTimer() code
The full StopwatchActivity code
What happens when you run the app
The story continues
Test drive the app
What just happened?
Rotating the screen changes the device configuration
From birth to death: the states of an activity
The activity lifecycle: from create to destroy
Your activity inherits the lifecycle methods
How do we deal with configuration changes?
Or save the current state...
...then restore the state in onCreate()
What happens when you run the app
The story continues
Test drive the app
There’s more to an activity’s life than create and destroy
The activity lifecycle: the visible lifetime
We need to implement two more lifecycle methods
The updated StopwatchActivity code
What happens when you run the app
Test drive the app
But what if an app is only partially visible?
The activity lifecycle: the foreground lifetime
Stop the stopwatch if the activity’s paused
What happens when you run the app
Test drive the app
The complete activity code
Your handy guide to the lifecycle methods
Your Android Toolbox

Chapter 5. The User Interface: Enjoy the View
Your user interface is made up of layouts and GUI components
Three key layouts: relative, linear, and grid
RelativeLayout displays views in relative positions
Adding padding
Positioning views relative to the parent layout
Attributes for positioning views relative to the parent layout
Positioning views relative to other views
Attributes for positioning views relative to other views
Use margins to add distance between views
RelativeLayout: a summary
LinearLayout displays views in a single row or column
A linear layout displays views in the order they appear in the layout XML
Let’s change up a basic linear layout
Here’s the starting point for the linear layout
Make a view streeeeetch by adding weight
Adding weight to one view
Adding weight to multiple views
Use gravity to specify where text appears in a view
Test drive
Using the android:gravity attribute: a list of values
Move the button to the right with layout-gravity
More values you can use with the android:layout-gravity attribute
The full linear layout code
LinearLayout: a summary
GridLayout displays views in a grid
Adding views to the grid layout
Let’s create a new grid layout
We’ll start with a sketch
Row 0: add views to specific rows and columns
Row 1: make a view span multiple columns
Row 2: make a view span multiple columns
The full code for the grid layout
GridLayout: a summary
Layouts and GUI components have a lot in common
GUI components are a type of View
What being a view buys you
A layout is really a hierarchy of Views
Playing with views
Text view
Edit Text
Button
Toggle button
Switch
Check boxes
Radio buttons
Spinner
Image views
Images: the layout XML
Adding images to buttons
Image Button
Scroll views
Toasts
Your Android Toolbox

Chapter 6. List Views and Adapters: Getting Organized
Every app starts with ideas
Categorize your ideas: top-level, category, and detail/edit activities
Navigating through the activities
Use ListViews to navigate to data
We’re going to build part of the Starbuzz app
The drink detail activity
The Starbuzz app structure
Here are the steps
The Drink class
The image files
The top-level layout contains an image and a list
Use a list view to display the list of options
The full top-level layout code
Test drive
Get ListViews to respond to clicks with a Listener
Set the listener to the list view
The full TopLevelActivity code
Where we’ve got to
A category activity displays the data for a single category
A ListActivity is an activity that contains only a list
How to create a list activity
android:entries works for static array data held in strings.xml
Connect list views to arrays with an array adapter
Add the array adapter to DrinkCategoryActivity
What happens when you run the code
Test drive the app
App review: where we’ve got to
How we handled clicks in TopLevelActivity
Pass data to an activity using the ListActivity onListItemClick() method
The full DrinkCategoryActivity code
A detail activity displays data for a single record
Retrieve data from the intent
Update the views with the data
The DrinkActivity code
What happens when you run the app
The story continues
Test drive the app
Your Android Toolbox

Chapter 7. Fragments: Make it Modular
Your app needs to look great on all devices
Your app may need to behave differently too
Fragments allow you to reuse code
The Workout app structure
Here are the steps
The Workout class
How to add a fragment to your project
Fragment layout code looks just like activity layout code
What fragment code looks like
Adding a fragment to an activity’s layout
Passing the workout ID to the fragment
Get the activity to set the workout ID
Activity states revisited
The fragment lifecycle
Your fragment inherits the lifecycle methods
Set the view’s values in the fragment’s onStart() method
Test drive the app
Where we’ve got to
We need to create a fragment with a list
A ListFragment is a fragment that contains only a list
How to create a list fragment
We’ll use an ArrayAdapter to set the values in the ListView
The updated WorkoutListFragment code
Display WorkoutListFragment in the MainActivity layout
Test drive the app
Wiring up the list to the detail
We need to decouple the fragment with an interface
First, add the interface to the list fragment
Then make the activity implement the interface
You want fragments to work with the back button
Don’t update—instead, replace
Using fragment transactions
The updated MainActivity code
Test drive the app
Rotating the device breaks the app
The WorkoutDetailFragment code
Phone versus tablet
The phone and tablet app structures
Put screen-specific resources in screen-specific folders
The different folder options
Tablets use layouts in the layout-large folder
The MainActivity phone layout
Phones will use DetailActivity to display details of the workout
The full DetailActivity code
Use layout differences to tell which layout the device is using
The revised MainActivity code
Test drive the app
Your Android Toolbox

Chapter 8. Nested Fragments: Dealing with Children
Creating nested fragments
Fragments and activities have similar lifecycles...
The StopwatchFragment code
The StopwatchFragment layout
Adding the stopwatch fragment to WorkoutDetailFragment
Add a FrameLayout where the fragment should appear
Then display the fragment in Java code
getFragmentManager() creates transactions at the activity lavel
Nested fragments need nested transactions
Display the fragment in its parent’s onCreateView() method
The full WorkoutDetailFragment code
Test drive the app
Why does the app crash if you press a button?
Let’s look at the StopwatchFragment layout code
The onClick attribute calls methods in the activity, not the fragment
First, remove the onClick attributes from the fragment’s layout
Make the fragment implement OnClickListener
Attach the OnClickListener to the buttons
The StopwatchFragment code
Test drive the app
Rotating the device re-creates the activity
onCreateView() runs AFTER the transactions have been replayed
The WorkoutDetailFragment code
Test drive the app
Your Android Toolbox

Chapter 9. Action Bars: Taking Shortcuts
Great apps have a clear structure
Different types of navigation
Let’s start with the action bar
The Android support libraries
Your project may include support libraries
We’ll get the app to use up to date themes
Apply a theme in AndroidManifest.xml
Define styles in style resource files
Set the default theme in styles.xml
What happens when you run the app
Test drive the app
Adding action items to the action bar
The menu resource file
The menu showAsAction attribute
Add a new action item
Inflate the menu in the activity with the onCreateOptionsMenu() method
React to action item clicks with the onOptionsItemSelected() method
Create OrderActivity
Start OrderActivity with the Create Order action item
The full MainActivity.java code
Test drive the app
Sharing content on the action bar
Add a share action provider to menu_main.xml
Specify the content with an intent
The full MainActivity.java code
Test drive the app
Enabling Up navigation
Setting an activity’s parent
Adding the Up button
Test drive the app
Your Android Toolbox

Chapter 10. Navigation Drawers: Going Places
The Pizza app revisited
Navigation drawers deconstructed
The Pizza app structure
Create TopFragment
Create PizzaFragment
Create PastaFragment
Create StoresFragment
Add the DrawerLayout
The full code for activity_main.xml
Initialize the drawer’s list
Use an OnItemClickListener to respond to clicks in the list view
The selectItem() method so far
Changing the action bar title
Closing the navigation drawer
The updated MainActivity.java code
Get the drawer to open and close
Using an ActionBarDrawerToggle
Modifying action bar items at runtime
The updated MainActivity.java code
Enable the drawer to open and close
Syncing the ActionBarDrawerToggle state
The updated MainActivity.java code
Test drive the app
The title and fragment are getting out of sync
Dealing with configuration changes
Reacting to changes on the back stack
Adding tags to fragments
Find the fragment using its tag
The full MainActivity.java code
Test drive the app
Your Android Toolbox

Chapter 11. SQLite Databases: Fire Up the Database
Back to Starbuzz
Android uses SQLite databases to persist data
Android comes with SQLite classes
The current Starbuzz app structure
We’ll change the app to use a database
The SQLite helper manages your database
Create the SQLite helper
1. Specify the database
Inside a SQLite database
You create tables using Structured Query Language (SQL)
Insert data using the insert() method
Update records with the update() method
Multiple conditions
The StarbuzzDatabaseHelper code
What the SQLite helper code does
What if you need to change the database?
SQLite databases have a version number
Upgrading the database: an overview
The story continues....
How the SQLite helper makes decisions
Upgrade your database with onUpgrade()
Downgrade your database with onDowngrade()
Let’s upgrade the database
Upgrading an existing database
Renaming tables
The full SQLite helper code
The SQLite helper code (continued)
What happens when the code runs
Your Android Toolbox

Chapter 12. Cursors and Asynctasks: Connecting to Databases
The story so far...
We’ll change the app to use the database
The current DrinkActivity code
Get data from the database with a cursor
A query lets you say what records you want from the database
The SQLiteDatabase query() method lets you build SQL using a query builder
Specifying table and columns
Applying multiple conditions to your query
Order data in your query
Using SQL functions in queries
SQL GROUP BY and HAVING clauses
Get a reference to the database
getReadableDatabase() versus getWritableDatabase()
getReadableDatabase()
getWritableDatabase()
The code for getting a cursor
To read a record from a cursor, you first need to navigate to it
Navigating cursors
Getting cursor values
The DrinkActivity code
What we’ve done so far
The current DrinkCategoryActivity code
How do we replace the array data in the ListView?
A CursorAdapter reads just enough data
The story continues
A SimpleCursorAdapter maps data to views
Creating the SimpleCursorAdapter
Closing the cursor and database
The revised code for DrinkCategoryActivity
Test drive the app
Put important information in the top-level activity
Add favorites to DrinkActivity
Add a new column to the cursor
Respond to clicks to update the database
The DrinkActivity code
Display favorites in TopLevelActivity
Display the favorite drinks in activity_top_level.xml
What changes are needed for TopLevelActivity.java
The new top-level activity code
Test drive the app
Cursors don’t automatically refresh
Change the cursor with changeCursor()
The revised TopLevelActivity.java code
Test drive the app
Databases can make your app go in sloooo-moooo....
What code goes on which thread?
AsyncTask performs asynchronous tasks
The onPreExecute() method
The doInBackground() method
The onProgressUpdate() method
The onPostExecute() method
The AsyncTask class
Execute the AsyncTask
The DrinkActivity.java code
A summary of the AsyncTask steps
Your Android Toolbox

Chapter 13. Services: At Your Service
Services work behind the scenes
The started service app
We’re going to create an IntentService
The IntentService from 50,000 feet
How to log messages
The full DelayedMessageService code
You declare services in AndroidManifest.xml
Add a button to activity_main.xml
You start a service using startService()
Test drive the app
We want to send a message to the screen
onStartCommand() runs on the main thread
The full DelayedMessageService.java code
The application context
Test drive the app
Can we improve on using Toasts?
How you use the notification service
You create notifications using a notification builder
Getting your notification to start an activity
Send the notification using the notification service
The full code for DelayedMessageService.java
What happens when you run the code
The story continues
Test drive the app
Bound services are more interactive
The steps needed to create the OdometerService
Create a new Odometer project
How binding works
Define the Binder
Get the service to do something
The Service class has four key methods
Location, location, location...
Add the LocationListener to the service
Registering the LocationListener
Tell the activity the distance traveled
The full OdometerService.java code
Update AndroidManifest.xml
Where we’ve got to
Update MainActivity’s layout
Create a ServiceConnection
Bind to the service when the activity starts
Display the distance traveled
The full MainActivity.java code
What happens when you run the code
The story continues
Test drive the app
Your Android Toolbox

Chapter 14. Material Design: Living in a Material World
Welcome to Material Design
CardViews and RecyclerViews
The Pizza app structure
Add the pizza data
Add the support libraries
Create the CardView
The full card_captioned_image.xml code
RecyclerViews use RecyclerView.Adapters
Create the basic adapter
Define the adapter’s ViewHolder
Create the ViewHolders
Each card view displays an image and a caption
Add the data to the card views
The full code for CaptionedImagesAdapter.java
Create the recycler view
Add the RecyclerView to the layout
The PizzaMaterialFragment.java code
A RecyclerView uses a layout manager to arrange its views
Specifying the layout manager
The full PizzaMaterialFragment.java code
Get MainActivity to use the new PizzaMaterialFragment
What happens when the code runs
The story continues
Test drive the app
Where we’ve got to
Create PizzaDetailActivity
What PizzaDetailActivity.java needs to do
The code for PizzaDetailActivity.java
Getting a RecyclerView to respond to clicks
You can listen to views from the adapter
Keep your adapters reusable
Add the interface to the adapter
Implement the listener in PizzaMaterialFragment.java
Test drive the app
Bring the content forward
The full code for fragment_top.xml
The full code for TopFragment.java
Test drive the app
Your Android Toolbox

Leaving town...

Appendix ART: The Android Runtime
What is the Android runtime (ART)?
Performance and size

Appendix ADB: The Android Debug Bridge
adb: your command-line pal
Running a shell
Get the output from logcat
And much, much more...

Appendix The Emulator: The Android Emulator
Why the emulator is so slow
How to speed up your Android development

Appendix Leftovers: The Top Ten Things (we didn’t cover)
1. Distributing your app
2. Content providers
3. The WebView class
4. Animation
5. Maps
6. Cursor loaders
7. Broadcast receivers
8. App widgets
9. NinePatch graphics
10. Testing

Appendix O’reilly®: Android Development
What will you learn from this book?
Why does this book look so different?
MINI CART

Your cart is empty.
MINI WISHLIST

Your wishlist is empty.