Android Application Development Cookbook doc

410 1.2K 0
Android Application Development Cookbook doc

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

www.it-ebooks.info www.it-ebooks.info Android ™ Application Development Cookbook 93 RECIPES FOR BUILDING WINNING APPS Wei-Meng Lee www.it-ebooks.info Android™ Application Development Cookbook: 93 Recipes for Building Winning Apps Published by John Wiley & Sons, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2013 by John Wiley & Sons, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-1-118-17767-9 ISBN: 978-1-118-22729-9 (ebk) ISBN: 978-1-118-24028-1 (ebk) ISBN: 978-1-118-26491-1 (ebk) Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions. Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specically disclaim all warranties, including without limitation warranties of tness for a particular purpose. No warranty may be created or extended by sales or pro- motional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the pub- lisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read. For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http:// booksupport.wiley.com . For more information about Wiley products, visit www.wiley.com. Library of Congress Control Number: 2012948549 Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Wrox Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its afliates, in the United States and other coun- tries, and may not be used without written permission. Android is a trademark of Google, Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book. www.it-ebooks.info To my family, Thanks for the understanding and support while I worked on getting this book ready. I love you all! www.it-ebooks.info www.it-ebooks.info ABOUT THE AUTHOR WEIMENG LEE is a technologist and founder of Developer Learning Solutions (www.learn2develop .net ), a technology company specializing in hands-on training on the latest mobile technologies. Wei-Meng has many years of training experience and his courses place special emphasis on the learn- ing-by-doing approach. This hands-on approach to learning programming makes understanding the subject much easier than reading books, tutorials, and other documentation. Wei-Meng is also the author of Beginning iOS 5 Application Development (Wrox, 2010) and Beginning Android 4 Application Development (Wrox, 2011). You can contact him at weimenglee@learn2develop.net. ABOUT THE TECHNICAL EDITOR CHAIM KRAUSE is a Simulation Specialist at the US Army’s Command and General Staff College where he develops various software products on a multitude of platforms, from iOS and Android devices to Windowsdesktops and Linux servers, among other duties. Python is his preferred language, but he is multilingual and also codes in Java, JavaScript/HTML5/CSS, and others. He was fortunate to begin his professional career in the software eld at Borland where he was a Senior Developer Support Engineer for Delphi. Outside of computer geek stuff, Chaim enjoys techno and dubstep music, and scootering with his two sled dogs Dasher and Minnie. www.it-ebooks.info EXECUTIVE EDITOR Robert Elliott SENIOR PROJECT EDITOR Ami Frank Sullivan TECHNICAL EDITOR Chaim Krause PRODUCTION EDITOR Christine Mugnolo COPY EDITOR Luann Rou EDITORIAL MANAGER Mary Beth Wakefield FREELANCER EDITORIAL MANAGER Rosemarie Graham ASSOCIATE DIRECTOR OF MARKETING David Mayhew MARKETING MANAGER Ashley Zurcher BUSINESS MANAGER Amy Knies PRODUCTION MANAGER Tim Tate VICE PRESIDENT AND EXECUTIVE GROUP PUBLISHER Richard Swadley VICE PRESIDENT AND EXECUTIVE PUBLISHER Neil Edde ASSOCIATE PUBLISHER Jim Minatel PROJECT COORDINATOR, COVER Katie Crocker COMPOSITOR Craig Johnson, Happenstance Type-O-Rama PROOFREADER Scott Klemp, Word One New York INDEXER Robert Swanson COVER DESIGNER Ryan Sneed COVER IMAGE © Paul Fleet / iStockPhoto CREDITS www.it-ebooks.info ACKNOWLEDGMENTS A LOT OF DEVELOPMENT in the Android world has happened since my last book, Beginning Android 4 Application Development, went to print. Google has released a new version of the SDK: Android4.1 SDK. With the Android 4.1 SDK and the ADT Plugin 20.0.3, it is now much easier to write Android applications — from those that run on older devices right up to the latest and greatest. I would like to thank some key people who have worked hard behind the scenes to make this book a reality. First, my personal gratitude to Bob Elliott, executive editor at Wrox. Bob is always ready to lend a listening ear and offer help when it’s needed. It is a great pleasure to work with Bob, as he is one of the most responsive people I have ever worked with. Thank you, Bob, for the help and guidance. Of course, I cannot forget Ami Sullivan, my editor (and friend), who is always a pleasure to work with. Thank you for your guidance and encouragement to keep the project going, Ami. I am also grateful to my technical editor, Chaim Krause. Chaim has been eagle-eye editing the book and testing my recipes, ensuring that my code works as written. Thanks, Chaim. Last but not least, I want to thank my parents and my wife, Sze Wa, for all the support they have given me. They have selessly adjusted their schedules to accommodate my busy schedule when I was working on this book. My wife, as always, has stayed up with me on numerous nights as I was furiously working to meet the deadlines, and for this I would like to say to her and my parents, “I love you all!” Finally, to our lovely dog, Ookii, thanks for staying by our side. www.it-ebooks.info www.it-ebooks.info [...]... Activity2: < /application> ... a Hello World application, chances are good that your application contains several activities that you need to connect in order to form a cohesive application This recipe shows you the various ways to link to another activity in your Android application www.it-ebooks.info 2  ❘  CHAPTER 1  Android Fundamentals Solution Suppose you have two activities in your application The following AndroidManifest.xml... www.it-ebooks.info 1 Android Fundamentals In this chapter, you learn about the fundamental topics in Android that most developers need to know, including how to link to other applications using the Intent object, how to communicate with other applications (or parts of the same application) using broadcast receivers, and how to pass data between activities RECIPE 1.1 LINKING ACTIVITIES Android Versions... create an Android project using Eclipse, and that you are already familiar with the structure of an Android project All the code samples in this book were written and tested using the Android 4.1 SDK, together with Eclipse (Juno release) and the ADT plugin 20.0.3 All projects are able to run on Android devices beginning with Android version 2.2 In particular, all projects make use of the Android Support... element within the element: android: name="net.learn2develop.Activity2" /> > If the activity you are trying to call does not exist on the device, your application will crash, displaying a message like the... activity, use the setResult() method, as shown in the following code: package net.learn2develop.passingdata; import import import import import import android. app.Activity; android. content.Intent; android. net.Uri; android. os.Bundle; android. view.View; android. widget.Toast; public class SecondActivity extends Activity { www.it-ebooks.info Recipe 1.2  Passing Data Between Activities  @Override public... Deploying Your Android Applications Recipe 11.1  Localizing Your Application 357 357 Solution 358 Recipe 11.2  Exporting Your Application as an APK File 362 Solution 362 Recipe 11.3  Deploying Your App Through E‑mail 365 Solution 365 Recipe 11.4  Deploying Your App Through the Web 367 Solution 368 Recipe 11.5  Deploying Your App Through an SD Card 369 Solution 369 Recipe 11.6  Specifying the Application . www.it-ebooks.info www.it-ebooks.info Android ™ Application Development Cookbook 93 RECIPES FOR BUILDING WINNING APPS Wei-Meng Lee www.it-ebooks.info Android Application Development Cookbook: . and other documentation. Wei-Meng is also the author of Beginning iOS 5 Application Development (Wrox, 2010) and Beginning Android 4 Application Development

Ngày đăng: 23/03/2014, 02:20

Từ khóa liên quan

Mục lục

  • Android Application Development Cookbook: 93 Recipes for Building Winning Apps

    • Introduction

    • Chapter 1: Android Fundamentals

      • Recipe 1.1  Linking Activities

        • Solution

        • Recipe 1.2  Passing Data Between Activities

          • Solution

          • Recipe 1.3  Passing Objects Between Activities

            • Solution

            • Recipe 1.4  Sending and Receiving Broadcasts

              • Solution

              • Recipe 1.5  Assigning Priorities to Broadcast Receivers

                • Solution

                • Recipe 1.6  Auto-Launching Your Application at Boot Time

                  • Solution

                  • Recipe 1.7  Calling Built-In Apps

                    • Solution

                    • Recipe 1.8  Making Your Application Callable By Others

                      • Solution

                      • Chapter 2: Using Views to Design the User Interface

                        • Recipe 2.1  Using Buttons

                          • Solution

                          • Recipe 2.2  Using Image Buttons

                            • Solution

                            • Recipe 2.3  Using Radio Buttons

                              • Solution

                              • Recipe 2.4  Using CheckBoxes

                                • Solution

                                • Recipe 2.5  Implementing a Star Rating System

                                  • Solution

                                  • Recipe 2.6  Using AutoCompleteTextView

                                    • Solution

                                    • Recipe 2.7  Displaying Web Pages

                                      • Solution

                                      • Recipe 2.8  Using the TimePicker

                                        • Solution

                                        • Recipe 2.9  Using the DatePicker

                                          • Solution

                                          • Recipe 2.10  Using LinearLayout for View Positioning

                                            • Solution

                                            • Recipe 2.11  Using RelativeLayout for View Positioning

                                              • Solution

Tài liệu cùng người dùng

Tài liệu liên quan