Learn Java for Android Development, Third Edition

Book description

Learn Java for Android Development, Third Edition, is an update of a strong selling book that now includes a primer on Android app development (in Chapter 1 and Appendix C, which is distributed in the book's code archive). This book teaches programmers the essential Java language skills necessary for effectively picking up and using the new Android SDK platform to build mobile, embedded, and even PC apps, especially game apps.

Android development is hot, and many programmers are interested in joining the fun. However, because this technology is based on Java, you should first obtain a solid grasp of the Java language and its APIs in order to improve your chances of succeeding as an effective Android app developer. This book helps you do that.

Each of the book's 16 chapters provides an exercise section that gives you the opportunity to reinforce your understanding of the chapter's material. Answers to the book's more than 700 exercises are provided in an appendix. A second appendix provides a significant game-oriented Java application, which you can convert into an Android app.

Once you complete this one-of-a-kind book written by Jeff Friesen, an expert Java developer and JavaWorld.com columnist, you should be ready to begin your indie or professional Android app development journey.

What you'll learn

  • The Java skills necessary for Android development

  • The core Java language fundamentals

  • Classes, objects, inheritance, polymorphism, and interfaces

  • Advanced Java language features (such as generics)

  • The basic Java APIs necessary for Android (such as the String class and threading)

  • The Collections Framework for organizing objects

  • The Concurrency Utilities for simplifying multithreading

  • Classic and New I/O

  • Networking and database access

  • Parsing, creating, and transforming XML documents

  • Additional APIs for creating and accessing ZIP and JAR files, and more

  • Who this book is for

    This book is for any programmer—including existing Java programmers and Objective-C based iPhone and iPad programmers—of any skill level who needs to obtain a solid understanding of the Java language and foundational Java APIs before jumping into Android app development.

    Table of contents

    1. Title Page
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Author
    6. About the Technical Reviewer
    7. Acknowledgments
    8. Introduction
    9. Chapter 1: Getting Started with Java
      1. What Is Java?
      2. Installing the JDK and Exploring Example Applications
      3. Installing and Exploring the Eclipse IDE
      4. Java Meets Android
      5. Summary
    10. Chapter 2: Learning Language Fundamentals
      1. Learning Application Structure
      2. Learning Comments
      3. Learning Identifiers
      4. Learning Types
      5. Learning Variables
      6. Learning Expressions
      7. Learning Statements
      8. Summary
    11. Chapter 3: Discovering Classes and Objects
      1. Declaring Classes
      2. Constructing Objects
      3. Encapsulating State and Behaviors
      4. Hiding Information
      5. Initializing Classes and Objects
      6. Collecting Garbage
      7. Revisiting Arrays
      8. Summary
    12. Chapter 4: Discovering Inheritance, Polymorphism, and Interfaces
      1. Building Class Hierarchies
      2. Changing Form
      3. Formalizing Class Interfaces
      4. Summary
    13. Chapter 5: Mastering Advanced Language Features, Part 1
      1. Mastering Nested Types
      2. Mastering Packages
      3. Mastering Static Imports
      4. Mastering Exceptions
      5. Summary
    14. Chapter 6: Mastering Advanced Language Features, Part 2
      1. Mastering Assertions
      2. Mastering Annotations
      3. Mastering Generics
      4. Mastering Enums
      5. Summary
    15. Chapter 7: Exploring the Basic APIs, Part 1
      1. Exploring Math
      2. Exploring Number and Its Children
      3. Exploring String, StringBuffer, and StringBuilder
      4. Exploring System
      5. Exploring Threads
      6. Summary
    16. Chapter 8: Exploring the Basic APIs, Part 2
      1. Exploring Random
      2. Exploring References
      3. Exploring Reflection
      4. Exploring StringTokenizer
      5. Exploring Timer and TimerTask
      6. Summary
    17. Chapter 9: Exploring the Collections Framework
      1. Exploring Collections Framework Fundamentals
      2. Exploring Lists
      3. Exploring Sets
      4. Exploring Sorted Sets
      5. Exploring Navigable Sets
      6. Exploring Queues
      7. Exploring Deques
      8. Exploring Maps
      9. Exploring Sorted Maps
      10. Exploring Navigable Maps
      11. Exploring the Arrays and Collections Utility APIs
      12. Exploring the Legacy Collection APIs
      13. Summary
    18. Chapter 10: Exploring the Concurrency Utilities
      1. Introducing the Concurrency Utilities
      2. Exploring Executors
      3. Exploring Synchronizers
      4. Exploring the Concurrent Collections
      5. Exploring the Locking Framework
      6. Exploring Atomic Variables
      7. Improving Performance with the Concurrency Utilities
      8. Summary
    19. Chapter 11: Performing Classic I/O
      1. Working with the File API
      2. Working with the RandomAccessFile API
      3. Working with Streams
      4. Working with Writers and Readers
      5. Summary
    20. Chapter 12: Accessing Networks
      1. Accessing Networks via Sockets
      2. Accessing Networks via URLs
      3. Accessing Network Interfaces and Interface Addresses
      4. Managing Cookies
      5. Summary
    21. Chapter 13: Migrating to New I/O
      1. Working with Buffers
      2. Working with Channels
      3. Working with Selectors
      4. Working with Regular Expressions
      5. Working with Charsets
      6. Working with Formatter and Scanner
      7. Summary
    22. Chapter 14: Accessing Databases
      1. Introducing Java DB
      2. Introducing SQLite
      3. Accessing Databases via JDBC
      4. Summary
    23. Chapter 15: Parsing, Creating, and Transforming XML Documents
      1. What Is XML?
      2. Parsing XML Documents with SAX
      3. Parsing and Creating XML Documents with DOM
      4. Parsing XML Documents with XMLPULL V1
      5. Selecting XML Document Nodes with XPath
      6. Transforming XML Documents with XSLT
      7. Summary
    24. Chapter 16: Focusing on Odds and Ends
      1. Focusing on Additional Language Features
      2. Focusing on Classloaders
      3. Focusing on Console
      4. Focusing on Design Patterns
      5. Focusing on Double Brace Initialization
      6. Focusing on Fluent Interfaces
      7. Focusing on Immutability
      8. Focusing on Internationalization
      9. Focusing on Logging
      10. Focusing on Preferences
      11. Focusing on Runtime and Process
      12. Focusing on the Java Native Interface
      13. Focusing on ZIP and JAR
      14. Summary
    25. Appendix A: Solutions to Exercises
      1. Chapter 1: Getting Started with Java
      2. Chapter 2: Learning Language Fundamentals
      3. Chapter 3: Discovering Classes and Objects
      4. Chapter 4: Discovering Inheritance, Polymorphism, and Interfaces
      5. Chapter 5: Mastering Advanced Language Features, Part 1
      6. Chapter 6: Mastering Advanced Language Features, Part 2
      7. Chapter 7: Exploring the Basic APIs, Part 1
      8. Chapter 8: Exploring the Basic APIs, Part 2
      9. Chapter 9: Exploring the Collections Framework
      10. Chapter 10: Exploring the Concurrency Utilities
      11. Chapter 11: Performing Classic I/O
      12. Chapter 12: Accessing Networks
      13. Chapter 13: Migrating to New I/O
      14. Chapter 14: Accessing Databases
      15. Chapter 15: Parsing, Creating, and Transforming XML Documents
      16. Chapter 16: Focusing on Odds and Ends
    26. Appendix B: Four of a Kind
      1. Understanding Four of a Kind
      2. Modeling Four of a Kind in Pseudocode
      3. Converting Pseudocode to Java Code
      4. Compiling, Running, and Distributing FourOfAKind
    27. Index

    Product information

    • Title: Learn Java for Android Development, Third Edition
    • Author(s):
    • Release date: March 2014
    • Publisher(s): Apress
    • ISBN: 9781430264545