ebook img

Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android PDF

464 Pages·2013·15.23 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android

ptg11524036 L earning Mobile App Development ptg11524036 97803e21947864_Book 1.indb i 11/21/13 2:56 PM This page intentionally left blank ptg11524036 L earning Mobile App Development A Hands-on Guide to Building Apps with iOS and Android ptg11524036 J akob Iversen M ichael Eierman U pper Saddle River, NJ € Boston € Indianapolis € San Francisco New York € Toronto € Montreal € London € Munich € Paris € Madrid Cape Town € Sydney € Tokyo € Singapore € Mexico City 97803e21947864_Book 1.indb iii 11/21/13 2:56 PM M any of the designations used by manufacturers and sellers to distinguish their E ditor-in-Chief products are claimed as trademarks. Where those designations appear in this Mark Taub book, and the publisher was aware of a trademark claim, the designations have S enior Acquisitions Editor been printed with initial capital letters or in all capitals. Trina MacDonald T he authors and publisher have taken care in the preparation of this book, S enior Development Editor but make no expressed or implied warranty of any kind and assume no Chris Zahn responsibility for errors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the M anaging Editor information or programs contained herein. Kristy Hart P roject Editor T he publisher offers excellent discounts on this book when ordered in quantity Andy Beaster for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, C opy Editor marketing focus, and branding interests. For more information, please contact: Barbara Hacha U .S. Corporate and Government Sales I ndexer (800) 382-3419 H eather McNeill c Y D edicated to Kim, Katja, Rebecca, and Natasja . D edicated to my wife, Theresa, and daughters, Lindsey and Kyra. Y ptg11524036 97803e21947864_Book 1.indb v 11/21/13 2:56 PM vi Contents Contents P reface xiv Part I O verview of Mobile App Development 1 1 W hy Mobile Apps? 3 Transformative Devices 3 Reaching Customers 4 Changing Business Process 6 Making Money 9 Summary 10 Exercises 10 2 A pp Design Issues and Considerations 13 App Design 13 Operating System Design Issues 13 Screen Size and Orientation Issues 17 ptg11524036 Connectivity Issues 18 Battery Issues 19 Hardware Issues 19 Device Differences 21 Android 21 iOS 23 Introducing Your First App 23 Contact Screen 24 Contact List Screen 24 Map Screen 25 Settings Screen 26 Summary 26 Exercises 27 P art II D eveloping the Android App 2 9 3 U sing Eclipse for Android Development 31 Starting a New Project 31 Setting Up the Workspace 32 Creating the Project 32 97803e21947864_Book 1.indb vi 11/21/13 2:56 PM Contents vii Components of the IDE 35 The Android Manifest 37 Configuring the Emulator 39 Coding the Interface 42 Coding App Behavior 50 Adding Code 52 Summary 54 Exercises 54 4 A ndroid Navigation and Interface Design 55 Activities, Layouts, and Intents 55 The Activity Class 56 Layout 56 Intents 57 Creating the Interface 57 Create the Project 58 Create the Navigation Bar 59 Create the Contact Layout 64 ptg11524036 Activating the Interface 78 Code the Navigation Bar 78 Code the Toggle Button 80 Code the DatePicker Dialog 82 Summary 86 Exercises 87 5 P ersistent Data in Android 89 Preferences, Files, and Database 89 Preferences 89 Files 90 Database 90 Creating the Database 91 Create the Database Helper Class 91 Create the Data Source Class 93 Using the Database 98 Capture User-Entered Data 99 Save User-Entered Data 101 Use the Debugger 105 97803e21947864_Book 1.indb vii 11/21/13 2:56 PM viii Contents Using Preferences 107 Create the Settings Layout 107 Code the Page•s Behavior 109 Summary 113 Exercises 114 6 Lists in Android: Navigation and Information Display 115 Lists and Adapters 115 Lists 115 Adapters 116 Simple Lists 116 Create the Data Source Method 116 Create the Layout 118 Code the Activity 118 Complex Lists 121 Create the Data Source Method 121 Create the Layout 123 ptg11524036 Create the Custom Adapter 125 Code the Activity 127 Add Delete Functionality 128 Completing the ContactList Activity 135 Populating the ContactActivity Screen 135 Coding the Add Button 138 Sort the Contacts List 139 Set ContactListActivity as the Default Activity 141 Set ContactActivity as Default Activity with no Contacts in Database 142 Summary 143 Exercises 143 7 Maps and Location in Android 145 Location Sensors, Maps, and Fragments 145 Location Sensors 145 Maps 146 Fragments 146 Setting Up for Maps 146 Passing Data Between Controllers 151 97803e21947864_Book 1.indb viii 11/21/13 2:56 PM Contents ix Finding Your Location 152 Geocoding: Get Coordinates from an Address 152 Get Coordinates from the GPS Sensor 155 Get Coordinates from Network Sensor 159 Get Coordinates from the Map 161 Displaying Your Contacts• Locations 164 Summary 170 Exercises 171 8 A ccess to Hardware and Sensors in Android 173 Sensors, Managers, and Other Hardware 173 Sensors 173 Managers 174 Other Hardware 174 Monitoring the Battery 174 Using Sensors to Create a Compass 177 Using the Phone 181 Using the Camera 183 ptg11524036 Summary 189 Exercise 190 P art III D eveloping the iOS App 1 91 9 U sing Xcode for iOS Development 193 Creating the Xcode Project 193 Project Settings 196 Creating the User Interface 199 Running the App in the Simulator 200 Adding App Behavior 202 Dismissing the Keyboard 205 App Icons and Launch Images 208 Summary 211 Exercises 211 10 iOS Navigation and Interface Design 213 Views and Controllers 213 View Controller 213 Tab Bar Controller 214 Navigation Controller 215 97803e21947864_Book 1.indb ix 11/21/13 2:56 PM

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.