《Android A programmers guide》由会员分享,可在线阅读,更多相关《Android A programmers guide(337页珍藏版)》请在金锄头文库上搜索。
1、 AndroidA Programmers Guide This page intentionally left blank AndroidA Programmers GuideJ.F. DiMarzioNew York Chicago San FranciscoLisbon London Madrid Mexico CityMilan New Delhi San JuanSeoul Singapore Sydney Toronto Copyright 2008 by The McGraw-Hill Companies. All rights reserved. Manufactured in
2、 the United States of America. Except as permittedunder the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, orstored in a database or retrieval system, without the prior written permission of the publisher.0-07-159989-4Th
3、e material in this eBook also appears in the print version of this title: 0-07-159988-6.All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name,we use names in an editorial fashion only, and to the benefit of the trade
4、mark owner, with no intention of infringement of thetrademark. Where such designations appear in this book, they have been printed with initial caps.McGraw-Hill eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate trainingprograms. For m
5、ore information, please contact George Hoare, Special Sales, at george_hoaremcgraw- or (212) 904-4069.TERMS OF USEThis is a copyrighted work and The McGraw-Hill Companies, Inc. (McGraw-Hill) and its licensors reserve all rights in and to the work. Useof this work is subject to these terms. Except as
6、 permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of thework, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute,disseminate, sell, publish or sublicense the work or any part of it wi
7、thout McGraw-Hills prior consent. You may use the work for your ownnoncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail tocomply with these terms.THE WORK IS PROVIDED AS IS. McGRAW-HILL AND ITS LICENSORS MAKE NO GU
8、ARANTEES OR WARRANTIES AS TO THEACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANYINFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DIS-CLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLI
9、ED WARRANTIES OF MER-CHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill and its licensors do not warrant or guarantee that the func-tions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill nor itslicensors shall
10、 be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for anydamages resulting therefrom. McGraw-Hill has no responsibility for the content of any information accessed through the work. Under nocircumstances shall McGraw-Hill and/or its licensors
11、 be liable for any indirect, incidental, special, punitive, consequential or similar damagesthat result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. Thislimitation of liability shall apply to any claim or cause whatsoever whet
12、her such claim or cause arises in contract, tort or otherwise.DOI: 10.1036/0071599886 ProfessionalWant to learn more?We hope you enjoy thisMcGraw-Hill eBook! Ifyoud like more information about this book,its author, or related books and websites,pleaseclick here. This book is dedicated to Suzannah, C
13、hristian, and Sophia About the AuthorJ.F. DiMarziois a developer with over 15 years ofexperience in networking and application developmentand is the author of seven books on computing technologies.He has become a leading resource in the fields of ITconsulting and development. He lives in Central Flo
14、rida.About the Technical EditorGilbert L. Polois a software developer with over 20years of experience working in the telecommunications,financial, and, most recently, educational industries. Hehas programmed in various languages including C, C+,Java, and C#.Copyright 2008 by The McGraw-Hill Companie
15、s. Click here for terms of use. Contents at a GlanceWhat Is Android? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11Downloading and Installing Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92Downloading and Installing the Android SDK . . . . . . . . . . . . . . . . . . . . . . . 213Exploring the Android SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354Application: Hello World! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535Using the Co