Android Apps for Absolute Beginners

Android Apps for Absolute Beginners

von: Wallace Jackson

Apress, 2011

ISBN: 9781430234470

Sprache: Englisch

339 Seiten, Download: 18373 KB

 
Format:  PDF, auch als Online-Lesen

geeignet für: Apple iPad, Android Tablet PC's Online-Lesen PC, MAC, Laptop


 

eBook anfordern

Mehr zum Inhalt

Android Apps for Absolute Beginners



  Title Page 2  
  Copyright Page 3  
  Contents at a Glance 5  
  Table of Contents 6  
  About the Author 11  
  About the Technical Reviewer 12  
  Acknowledgments 13  
  Introduction 14  
     The Target: The Programming Neophyte 14  
     The Weapon: Android, the Innovative Mobile Code Environment 14  
     How This Book Is Organized 15  
     The Formula for Success 15  
     Required Software, Materials, and Equipment 16  
        Operating System and IDE 16  
        Software Development Kits 17  
        Dual Monitors 17  
  Chapter 1: Preliminary Information: Before We Get Started 18  
     Some History: What Is Android? 19  
     Advantage Android: How Can Android Benefit Me? 20  
     The Scope of This Book 21  
        What's Covered 21  
        What's Not Covered 22  
     Preparing for Liftoff: SDK Tools to Download 22  
        Java 23  
        Eclipse 24  
        Android SDK 25  
     Summary 25  
  Chapter 2: What's Next? Our Road Ahead 27  
     Your Android Development IDE 27  
     Java, XML, and How Android Works 29  
     The Android Application Framework 30  
     Screen Layout Design 30  
     User Interface Design 31  
     Graphics and Animation Design 31  
     Interactivity 32  
     Content Providers 32  
     Intents and Intent Filters 33  
     The Future of Android 33  
     Summary 34  
  Chapter 3: SeHing Up Your Android Development Environment 35  
     Installing Java, Eclipse, and Android 35  
        Java SE and JRE: Your Foundation for Application Development.. 36  
        Eclipse IDE: The Development Environment 37  
        Android SDK: The Android Tool Kit for Eclipse 41  
        Android Development Tool: Android Tools for Eclipse 42  
        The Android Environment Within Eclipse 46  
     Updating the Android SDK 47  
     Setting Up AVDs and Smartphone Connections 49  
        AVDs: Smartphone Emulators 49  
        USB Smartphone Drivers: External Devices 51  
     Developing on 64-Bit Computing Platforms 52  
     Summary 54  
  Chapter 4: Introducing the Android Software Development Platform 56  
     Understanding Java SE and the Dalvik Virtual Machine 57  
     The Directory Structure of an Android Project 58  
        Common Default Resources Folders 59  
        The Values Folder 60  
     Leveraging Android XML (Your Secret Weapon) 61  
        Screen Sizes 62  
        Desktop Clocks 62  
     Using Your Android Application Resources 63  
        Bitmap Images 63  
        Alternate Resource Folders 64  
     Launching Your Application: The AndroidManifest.xml File 65  
     Creating Your First Android Application 66  
        Launching Eclipse 66  
        Creating an Android Project 67  
        Inspecting and Editing the Application Files 70  
           Opening the MyHelloWorld Activity 71  
           Opening the UI Definition 72  
           Opening the Strings Resource File 73  
        Setting a Variable Value in strings.xml 74  
        Running the App 75  
        Adding an Application Icon 76  
           Adding Transparency 77  
           Creating the Icons 78  
     Summary 80  
  Chapter 5: Android Framework Overview 82  
     The Foundation of OOP: The Object 83  
        Some OOP Terminology 84  
        The Blueprint for an Object: The Class 85  
        Providing Structure for Your Classes: Inheritance 90  
        Defining an Interface 91  
        Bundling Classes in a Logical Way: The Package 92  
     An Overview of XML 93  
     The Anatomy of an Android Application: The APK File 94  
     Android Application Components 95  
        Android Activities: Defining the UI 96  
        Android Services: Processing in the Background 97  
        Broadcast Receivers: Announcements and Notifications 97  
        Content Providers: Data Management 98  
     Android Intent Objects: Messaging for Components 99  
     Android Manifest XML: Declaring Your Components 100  
     Summary 102  
  Chapter 6: Screen Layout Design: Views and Layouts 104  
     Android View Hierarchies 104  
        Using the View Class 105  
        Nesting Views: Using the ViewGroup Class 105  
     Defining Screen Layouts: Using XML 107  
        Setting Up for Your Screen Layout 107  
        Using Linear Layouts 108  
           Creating the LinearLayouts Project in Eclipse 110  
           Editing the main.xml File 113  
           Editing the strings.xml File 114  
           Updating main.xml File 115  
           Viewing LinearLayoutActivity.java 116  
           Running the LinearLayout App 117  
        Using Relative Layouts 119  
        Sliding Drawers: Expanding Your UI 123  
        Using Padding and Margins with Views and Layouts 126  
        Setting Padding in Views 127  
        Setting Margins in ViewGroups 127  
     Summary 127  
  Chapter 7: UI Design: Buttons, Menus, and Dialogs 129  
     Using Common UI Elements 129  
        Adding an Image Button to Your Layout 130  
           Defining Multistate Image Button Graphics in XML 130  
           Creating the UI Image Button Project in Eclipse 131  
           Creating the button1.xml File 133  
           Editing the main.xml File 137  
           Replacing the Default Background 138  
        Adding a Text to Your Layout 140  
        Adding an Image 141  
     Using Menus in Android 143  
        Creating the Menu Structure with XML 144  
        Defining Menu Item Strings 145  
        Inflating the Menu Structure via Java 148  
        Running the Application in the Android Emulator 150  
        Making the Menu Work 150  
     Adding Dialogs 154  
        Using Custom Dialog Subclasses 154  
        Displaying an Alert Dialog 154  
     Summary 159  
  Chapter 8: An Introduction to Graphics Resources in Android 160  
     Introducing the Drawables 161  
        Implementing Images 161  
        Core Drawable Subclasses 162  
     Using Bitmap Images in Android 162  
        PNG Images 163  
        JPEG and GIF Images 164  
     Creating Animation in Android 164  
        Frame-based or Cel 2D Animation 164  
           Controlling Frame-based Animation via Java 168  
           Running the Frame-based Animation App in the Emulator 172  
        Tween Animation in Android 173  
           Creating the text_animation.xml File 174  
           Controlling Tween Animation via Java 177  
     Using Transitions 179  
     Creating 9-Patch Custom Scalable Images 183  
     Playing Video in Your Android Apps 189  
        Adding a VideoView Object 189  
        Adding the Java for Video 191  
     Summary 194  
  Chapter 9: Adding Interactivity: Handling UI Events 195  
     An Overview of UI Events in Android 195  
        Listening for and Handling Events 195  
        Handling UI Events via the View Class 196  
        Event Callback Methods 196  
     Handling onClick Events 197  
        Implementing an onClick Listener for a UI Element.. 198  
        Adding an on Click Listener to an Activity in Android 199  
           Creating the Event Handling Examples Project in Eclipse 199  
           Editing the HandlerExamples.java File 200  
           Editing the main.xml File 204  
           Updating HandlerExamples.java 205  
           Running the Event Handling Examples App in the Emulator 206  
     Android Touchscreen Events: onTouch 207  
     Touchscreen's Right-Click Equivalent: onLongClick 207  
     Keyboard Event Listeners: onKeyUp and onKeyDown 210  
        Adding the XML for Keyboard Events 211  
        Adding the Java for Keyboard Events 211  
     Context Menus in Android: onCreateContextMenu 214  
        Adding the XML for Context Menus 214  
        Adding the Java for Context Menus 216  
     Controlling the Focus in Android 221  
        Adding the XML for Focus Control 222  
        Adding the Java for Focus Control 226  
        Setting Focus Availability 228  
     Summary 228  
  Chapter 10: Understanding Content Providers 229  
     An Overview of Android Content Providers 229  
        Databases and Database Management Systems 230  
        Android Built-in Content Providers 231  
           Contacts Database Contact Providers 232  
           Android MediaStore Content Providers 234  
     Defining a Content Provider 234  
        Creating the Content Providers Example Project in Eclipse 235  
        Defining Security Permissions 236  
        Adding Data to the Contacts Database 240  
     Working with a Database 243  
        Querying a Content Provider: Accessing the Content 243  
        Appending to a Content Provider: Adding New Content 249  
        Modifying Content Provider Data: Updating the Content 255  
        Removing Content Provider Data: Deleting Content 260  
     Summary 265  
  Chapter 11: Understanding Intents and Intent Filters 267  
     What Is an Intent? 267  
     Android Intent Messaging via Intent Objects 268  
     Intent Resolution: Implicit Intents & Explicit Intents 271  
        Explicit Intents 271  
        Implicit Intents 272  
     Using Intents with Activities 273  
        Writing the Digital Clock Activity 278  
        Wiring up the Application 281  
        Sending Intents 283  
     Android Services: Data Processing in its own Class 286  
        Using Intents with Services 286  
        Creating a Service 289  
        Implementing Our MediaPlayer Functions 293  
        Wiring the Buttons to the Service 294  
        Running the Application 295  
     Using Intents with Broadcast Receivers 296  
        Creating the Timer User Interface via XML 297  
        Creating a Timer Broadcast Receiver 298  
        Configuring the AndroidManifest.xml file Tag 300  
        Implementing our Intent 301  
        Running the Timer Application via the Android 1.5 Emulator 306  
     Summary 307  
  Chapter 12: The Future 308  
     Widgets: Creating Your Own Widgets in Android 308  
     Location-Based Services in Android 310  
     Google Maps in Android 311  
     Google Search in Android 314  
     Data Storage in Android 315  
        Shared Preferences 315  
        Internal Memory 316  
        External Memory 316  
        Using SaUte 317  
     Device Administration: Security for IT Deployments 317  
     Using the Android Camera Class to control a Camera 318  
     3D Graphics: Using OpenGL ES 1.x in Android 318  
     FaceDetector 319  
     Sound Pool 319  
     MediaRecorder 320  
     Summary 321  
  Index 322  

Kategorien

Service

Info/Kontakt