Java Programming for Android Developers For Dummies

Java Programming for Android Developers For Dummies

by Barry Burd
Java Programming for Android Developers For Dummies

Java Programming for Android Developers For Dummies

by Barry Burd

Paperback

$34.99 
  • SHIP THIS ITEM
    Qualifies for Free Shipping
  • PICK UP IN STORE
    Check Availability at Nearby Stores

Related collections and offers


Overview

Develop the next killer Android App using Java programming!

Android is everywhere! It runs more than half the smartphones in the U.S.—and Java makes it go. If you want to cash in on its popularity by learning to build Android apps with Java, all the easy-to-follow guidance you need to get started is at your fingertips. Inside, you'll learn the basics of Java and grasp how it works with Android; then, you'll go on to create your first real, working application. How cool is that?

The demand for Android apps isn't showing any signs of slowing, but if you're a mobile developer who wants to get in on the action, it's vital that you get the necessary Java background to be a success. With the help of Java Programming for Android Developers For Dummies, you'll quickly and painlessly discover the ins and outs of using Java to create groundbreaking Android apps—no prior knowledge or experience required!

  • Get the know-how to create an Android program from the ground up
  • Make sense of basic Java development concepts and techniques
  • Develop the skills to handle programming challenges
  • Find out how to debug your app

Don't sit back and watch other developers release apps that bring in the bucks! Everything you need to create that next killer Android app is just a page away!


Product Details

ISBN-13: 9781119301080
Publisher: Wiley
Publication date: 11/07/2016
Pages: 464
Product dimensions: 7.30(w) x 9.20(h) x 0.90(d)

About the Author

Barry Burd, PhD, is a professor in the Department of Mathematics and Computer Science at Drew University in Madison, New Jersey. He has lectured at conferences in the United States, Europe, Australia, and Asia. He hosts podcasts and videos about software and other technology topics. He is the author of many articles and books, including Java For Dummies.

Table of Contents

Introduction 1

How to Use This Book 1

Conventions Used in This Book 2

What You Don’t Have to Read 2

Foolish Assumptions 3

How This Book Is Organized 4

Part 1: Getting Started with Java Programming for Android Developers 4

Part 2: Writing Your Own Java Programs 5

Part 3: Working with the Big Picture: Object-Oriented Programming 5

Part 4: Powering Android with Java Code 5

Part 5: The Part of Tens 5

More on the web! 6

Icons Used in This Book 6

Beyond the Book 7

Where to Go from Here 7

Part 1: Getting Started with Java Programming For Android Developers 9

Chapter 1: All about Java and Android 11

The Consumer Perspective 12

The Many Faces of Android 13

The Developer Perspective 15

Java 15

Xml 18

Linux 19

From Development to Execution with Java 20

What is a compiler? 20

What is a virtual machine? 24

Java, Android, and Horticulture 26

Chapter 2: Getting the Tools That You Need 27

The Stuff You Need 28

If You Don’t Like to Read the Instructions . 29

Getting This Book’s Sample Programs 32

Setting Up Java 33

Setting Up Android Studio and the Android SDK 37

Launching the Android Studio IDE 38

Opening One of This Book’s Sample Programs 40

Using Android Studio 42

Starting up 42

The main window 43

Things You Might Eventually Have to Do 48

Installing new versions (and older versions) of Android 49

Creating an Android virtual device 50

Chapter 3: Creating and Running an Android App 55

Creating Your First App 56

First things first 57

Launching your first app 61

If the Emulator Doesn’t Behave 63

Running third-party emulators 64

Testing apps on a physical device 65

The Project Tool Window 68

The app/manifests branch 68

The app/java branch 69

The app/res branches 69

The Gradle scripts branch 70

Dragging, Dropping, and Otherwise Tweaking an App 70

Creating the “look” 71

Coding the behavior 83

What All That Java Code Does 88

Finding the EditText and TextView components 88

Responding to a button click 90

The rest of the code 91

Going Pro 93

Part 2: Writing Your Own Java Programs 95

Chapter 4: An Ode to Code 97

Hello, Android! 97

The Java Class 99

The names of classes 103

Why Java Methods Are Like Meals at a Restaurant 105

What does Mom’s Restaurant have to do with Java? 106

Method declaration 106

Method call 108

Method parameters 108

The chicken or the egg 109

How many parameters? 109

Method declarations and method calls in an Android program 111

Punctuating Your Code 116

Comments are your friends 119

What’s Barry’s excuse? 122

All About Android Activities 123

Extending a class 124

Overriding methods 124

An activity’s workhorse methods 125

Chapter 5: Java’s Building Blocks 129

Info Is As Info Does 130

Variable names 133

Type names 133

Assignments and initializations 134

Expressions and literals 136

How to string characters together 139

Java’s primitive types 140

Things You Can Do with Types 142

Add letters to numbers (Huh?) 144

Java’s exotic assignment operators 146

True bit 147

Java isn’t like a game of horseshoes 148

Use Java’s logical operators 150

Parenthetically speaking 155

Chapter 6: Working with Java Types 157

Working with Strings 157

Going from primitive types to strings 158

Going from strings to primitive types 159

Getting input from the user 160

Practice Safe Typing 163

Widening is good; narrowing is bad 165

Incompatible types 166

Using a hammer to bang a peg into a hole 167

Chapter 7: Though These Be Methods, Yet There Is Madness in’t 169

Minding Your Types When You Call a Method 170

Method parameters and Java types 173

If at first you don’t succeed 174

Return types 174

The great void 175

Displaying numbers 176

Primitive Types and Pass-by Value 177

What’s a developer to do? 181

A final word 183

Chapter 8: What Java Does (and When) 187

Making Decisions 187

Java if statements 189

Choosing among many alternatives 191

Some formalities concerning Java switch statements 198

Repeating Instructions Over and Over Again 199

Check, and then repeat 200

Repeat, and then check 207

Count, count, count 211

What’s Next? 214

Part 3: Working with the Big Picture: Object-oriented Programming 215

Chapter 9: Why Object-Oriented Programming Is Like Selling Cheese 217

Classes and Objects 219

What is a class, really? 220

What is an object? 222

Creating objects 223

Reusing names 227

Calling a constructor 230

More About Classes and Objects (Adding Methods to the Mix) 232

Constructors with parameters 235

The default constructor 239

This is it! 240

Giving an object more responsibility 242

Members of a class 245

Reference types 246

Pass by reference 247

Java’s Modifiers 251

Public classes and default-access classes 251

Access for fields and methods 253

Using getters and setters 257

What does static mean? 260

To dot, or not 263

A bad example 264

What’s Next? 265

Chapter 10: Saving Time and Money: Reusing Existing Code 267

The Last Word on Employees — Or Is It? 268

Extending a class 269

Overriding methods 272

Java’s super keyword 278

Java annotations 279

More about Java’s Modifiers 281

Keeping Things Simple 285

Using an interface 286

Some Observations about Android’s Classes 291

Java’s super keyword, revisited 292

Casting, again 293

Part 4: Powering Android with Java Code 295

Chapter 11: The Inside Story 297

A Button-Click Example 297

This is a callback 302

Android string resources (A slight detour) 302

Introducing Inner Classes 307

No Publicity, Please! 309

Lambda Expressions 313

Chapter 12: Dealing with a Bunch of Things at a Time 317

Creating a Collection Class 318

More casting 320

Java generics 321

Java’s wrapper classes 325

Stepping Through a Collection 326

Using an iterator 326

The enhanced for statement 328

A cautionary tale 329

Functional programming techniques 331

Java’s Many Collection Classes 332

Arrays 333

String resource arrays 336

Java’s varargs 337

Using Collections in an Android App 340

The listener 343

The adapter 343

Chapter 13: An Android Social Media App 345

The Twitter App’s Files 346

The Twitter4J API jar file 346

The manifest file 348

The main activity’s layout file 349

How to Talk to the Twitter Server 352

Using OAuth 353

Making a ConfigurationBuilder 353

Getting OAuth keys and tokens 355

The Application’s Main Activity 357

The onCreate method 362

The button listener methods 363

The trouble with threads 363

Understanding Android’s AsyncTask 366

My Twitter app’s AsyncTask classes 368

Cutting to the chase, at last 370

Java’s Exceptions 372

Catch clauses 374

A finally clause 375

Passing the buck 376

Chapter 14: Hungry Burds: A Simple Android Game 381

Introducing the Hungry Burds Game 382

The Main Activity 385

The code, all the code, and nothing but the code 388

Measuring the display 392

Constructing a Burd 395

Android animation 398

Creating menus 400

Shared preferences 403

Informing the user 404

It’s Been Fun 405

Part 5: the Part of Tens 407

Chapter 15: Ten Ways to Avoid Mistakes 409

Putting Capital Letters Where They Belong 409

Breaking Out of a switch Statement 410

Comparing Values with a Double Equal Sign 410

Adding Listeners to Handle Events 411

Defining the Required Constructors 411

Fixing Nonstatic References 412

Staying within Bounds in an Array 412

Anticipating Null Pointers 412

Using Permissions 414

The Activity Not Found 414

Chapter 16: Ten Websites for Developers 415

This Book’s Websites 415

The Horse’s Mouth 416

Finding News and Reviews 416

Index 417

From the B&N Reads Blog

Customer Reviews