- Subjects
- Published
-
Hoboken, NJ :
For Dummies, a Wiley Brand
[2017]
- Language
- English
- Main Author
- Edition
- 2nd edition
- Item Description
- Includes index.
- Physical Description
- xi, 437 pages : illustrations ; 24 cm
- ISBN
- 9781119301080
- Introduction
- How to Use This Book
- Conventions Used in This Book
- What You Don't Have to Read
- Foolish Assumptions
- How This Book Is Organized
- Part 1. Getting Started with Java Programming for Android Developers
- Part 2. Writing Your Own Java Programs
- Part 3. Working with the Big Picture: Object-Oriented Programming
- Part 4. Powering Android with Java Code
- Part 5. The Part of Tens
- More on the web!
- Icons Used in This Book
- Beyond the Book
- Where to Go from Here
- Part 1. Getting Started with Java Programming for Android Developers
- Chapter 1. All about Java and Android
- The Consumer Perspective
- The Many Faces of Android
- The Developer Perspective
- Java
- XML
- Linux
- From Development to Execution with Java
- What is a compiler?
- What is a virtual machine?
- Java, Android, and Horticulture
- Chapter 2. Getting the Tools That You Need
- The Stuff You Need
- If You Don't Like to Read the Instructions
- Getting This Book's Sample Programs
- Setting Up Java
- Setting Up Android Studio and the Android SDK
- Launching the Android Studio IDE
- Opening One of This Book's Sample Programs
- Using Android Studio
- Starting up
- The main window
- Things You Might Eventually Have to Do
- Installing new versions (and older versions) of Android
- Creating an Android virtual device
- Chapter 3. Creating and Running an Android App
- Creating Your First App
- First things first
- Launching your first app
- If the Emulator Doesn't Behave
- Running third-party emulators
- Testing apps on a physical device
- The Project Tool Window
- The app/manifests branch
- The app/java branch
- The app/res branches
- The Gradle scripts branch
- Dragging, Dropping, and Otherwise Tweaking an App
- Creating the "look"
- Coding the behavior
- What All That Java Code Does
- Finding the EditText and TextView components
- Responding to a button click
- The rest of the code
- Going Pro
- Part 2. Writing Your Own Java Programs
- Chapter 4. An Ode to Code
- Hello, Android!
- The Java Class
- The names of classes
- Why Java Methods Are Like Meals at a Restaurant
- What does Mom's Restaurant have to do with Java?
- Method declaration
- Method call
- Method parameters
- The chicken or the egg
- How many parameters?
- Method declarations and method calls in an Android program
- Punctuating Your Code
- Comments are your friends
- What's Barry's excuse?
- All About Android Activities
- Extending a class
- Overriding methods
- An activity's workhorse methods
- Chapter 5. Java's Building Blocks
- Info Is As Info Does
- Variable names
- Type names
- Assignments and initializations
- Expressions and literals
- How to string characters together
- Java's primitive types
- Things You Can Do with Types
- Add letters to numbers (Huh?)
- Java's exotic assignment operators
- True bit
- Java isn't like a game of horseshoes
- Use Java's logical operators
- Parenthetically speaking
- Chapter 6. Working with Java Types
- Working with Strings
- Going from primitive types to strings
- Going from strings to primitive types
- Getting input from the user
- Practice Safe Typing
- Widening is good; narrowing is bad
- Incompatible types
- Using a hammer to bang a peg into a hole
- Chapter 7. Thought These Be Methods, Yet There Is Madness in't
- Minding Your Types When You Call a Method
- Method parameters and Java types
- If at first you don't succeed
- Return types
- The great void
- Displaying numbers
- Primitive Types and Pass-by Value
- What's a developer to do?
- A final word
- Chapter 8. What Java Does (and When)
- Making Decisions
- Java if statements
- Choosing among many alternatives
- Some formalities concerning Java switch statements
- Repeating Instructions Over and Over Again
- Check, and then repeat
- Repeat, and then check
- Count, count, count
- What's Next?
- Part 3. Working with the Big Picture: Object-Oriented Programming
- Chapter 9. Why Object-Oriented Programming Is Like Selling Cheese
- Classes and Objects
- What is a class, really?
- What is an object?
- Creating objects
- Reusing names
- Calling a constructor
- More About Classes and Objects (Adding Methods to the Mix)
- Constructors with parameters
- The default constructor
- This is it!
- Giving an object more responsibility
- Members of a class
- Reference types
- Pass by reference
- Java's Modifiers
- Public classes and default-access classes
- Access for fields and methods
- Using getters and setters
- What does static mean?
- To dot, or not
- A bad example
- What's Next?
- Chapter 10. Saving Time and Money: Reusing Existing Code
- The Last Word on Employees - Or Is It?
- Extending a class
- Overriding methods
- Java's super Keyword
- Java annotations
- More about Java's Modifiers
- Keeping Things Simple
- Using an interface
- Some Observations about Android's Classes
- Java's super keyword, revisited
- Casting, again
- Part 4. Powering Android with Java Code
- Chapter 11. The Inside Story
- A Button-Click Example
- This is a callback
- Android string resources (A slight detour)
- Introducing Inner Classes
- No Publicity, Please!
- Lambda Expressions
- Chapter 12. Dealing with a Bunch of Things at a Time
- Creating a Collection Class
- More casting
- Java generics
- Java's wrapper classes
- Stepping Through a Collection
- Using an iterator
- The enhanced for statement
- A cautionary tale
- Functional programming techniques
- Java's Many Collection Classes
- Arrays
- String resource arrays
- Java's varargs
- Using Collections in an Android App
- The listener
- The adapter
- Chapter 13. An Android Social Media App
- The Twitter App's Files
- The Twitter4J API jar file
- The manifest file
- The main activity's layout file
- How to Talk to the Twitter Server
- Using OAuth
- Making a ConfigurationBuilder
- Getting OAuth keys and tokens
- The Application's Main Activity
- The onCreate method
- The button listener methods
- The trouble with threads
- Understanding Android's AsyncTask
- My Twitter app's AsyncTask classes
- Cutting to the chase, at last
- Java's Exceptions
- Catch clauses
- A finally clause
- Passing the buck
- Chapter 14. Hungry Burds: A Simple Android Game
- Introducing the Hungry Burds Game
- The Main Activity
- The code, all the code, and nothing but the code
- Measuring the display
- Constructing a Burd
- Android animation
- Creating menus
- Shared preferences
- Informing the user
- It's Been Fun
- Part 5. The Part of Tens
- Chapter 15. Ten Ways to Avoid Mistakes
- Putting Capital Letters Where They Belong
- Breaking Out of a switch Statement
- Comparing Values with a Double Equal Sign
- Adding Listeners to Handle Events
- Defining the Required Constructors
- Fixing Nonstatic References
- Staying within Bounds in an Array
- Anticipating Null Pointers
- Using Permissions
- The Activity Not Found
- Chapter 16. Ten Websites for Developers
- This Book's Websites
- The Horse's Mouth
- Finding News and Reviews
- Index