ebook img

Android Apps with Eclipse PDF

368 Pages·2012·17.85 MB·English
by  
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 Android Apps with Eclipse

For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. Android Apps with Eclipse ■ ■ ■ Onur Cinar i Contents at a Glance About the Author................................................................................................x About the Technical Reviewer..........................................................................xi Introduction.....................................................................................................xii ■ Chapter 1: Android Primer...............................................................................1 ■ Chapter 2: Application Architecture..............................................................27 ■ Chapter 3: Eclipse Primer..............................................................................45 ■ Chapter 4: Mastering Eclipse.........................................................................73 ■ Chapter 5: Android Development Tools for Eclipse......................................111 ■ Chapter 6: Project: Movie Player.................................................................151 ■ Chapter 7: Android Native Development Using Eclipse................................185 ■ Chapter 8: Project: Extending Movie Player for AVI Movies........................239 ■ Chapter 9: Android Scripting Using Eclipse................................................271 ■ Chapter 10: Project: Movie Player Using HTML and JavaScript..................307 ■ Appendix A: Testing Android Applications...................................................333 ■ Index............................................................................................................349 iv Introduction Android is one of the major players in the mobile phone market, and its market share is continuously growing. Android is the first complete, open, and free mobile platform, and it offers endless opportunities for mobile application developers. As with all other platforms, having a robust and flexible development environment is the key for the platform's success. Eclipse is the most adopted integrated development environment (IDE) for Java programmers. And now Eclipse is the preferred IDE for Android app developers. Android Apps with Eclipse provides a detailed overview of Eclipse, including the steps and illustrations to help Android developers quickly get up to speed on Eclipse and to streamline their day-to-day software development. Who This Book Is For This book is for both beginners and intermediate developers who would like to quickly come up to speed on Android development using the Eclipse IDE. What You Will Learn This book covers the following topics:  How the Android platform works and the basics of Android application development  How to use the most popular Java IDE, Eclipse, to develop Android applications  How to install and configure Eclipse for Android development  How to leverage Eclipse with the Android Native Development Kit (NDK) for C/C++ needs  How to leverage Eclipse for scripting using Android's Scripting Layer for Android (SL4A)  How to debug and troubleshoot Android applications using Eclipse xii INTRODUCTION Downloading the Code The source code for this book is available to readers from http://www.apress.com. Contacting the Author Readers can contact the author through his Android Apps with Eclipse site at http://www.zdo.com/android-apps-with-eclipse. xiii 1 Chapter Android Primer In this chapter, we will briefly cover the Android platform from various angles. We will start with Android’s history, to better understand the motivations behind its formation. Then we will explore the Android platform architecture’s fine combination of technologies that empower the platform to deliver a superior mobile experience. We will emphasis the multilayer Android security framework, which employs both software and hardware to keep the platform secure. We will briefly review the service application programming interfaces (APIs) that are provided through the Android framework for user-level applications to interact with the platform. Finally, we will discuss Android application deployment and distribution. Android History Android Inc. was founded in Silicon Valley, California, in October 2003, with the idea of providing a mobile platform that is more aware of the user’s location and preferences. Google acquired Android Inc. in August 2005 as a wholly owned subsidiary of Google Inc. Google’s main intention was to provide a fully open platform, backed by Google technologies, for both the users and the application developers. In November 2007, the Open Handset Alliance was founded as a consortium to develop an open standard for mobile devices. Open Handset Alliance began its journey by announcing the Android platform. In less than a year, new members started joining this consortium. 2 CHAPTER 1: Android Primer Android became an open source initiative that is led by Google under Open Handset Alliance’s umbrella. The goal of the Android open source project is to provide an open platform to improve the mobile experience of users. Android is the first complete, open, and free mobile platform.  Complete: The Android platform is a robust, secure, easily upgradable, mobile platform with a comprehensive framework and well-defined interfaces. It allows application developers to develop and fully blend their applications into the platform. It also provides compatibility and certification programs, so device manufacturers can design highly compliant devices.  Open: The entire Android platform has been developed and provided under open source Apache licensing terms. Android does not distinguish between preloaded applications and third-party applications. Developers have full access to device features and services while developing applications.  Free: The Android platform does not charge any licensing, royalty, membership, or certification fees to develop applications on the platform. Android platform source code and software development kits are provided free of charge to application developers. The software development platform is widely available on many desktop operating systems, allowing application developers to develop applications using the operating system of their choice. Today, Android is one of the major players in mobile phone market. Based on the recent market analysis, on average, 700 thousand Android devices are activated daily, and more than 200 million devices are already activated. Android currently has 48% of the mobile phone market share, and it’s growing rapidly. Android Versions The first beta of the Android platform was released on November 5, 2007. Since then, it has been through a number of updates and bug fixes. Although bug fixes are usually transparent from the application developer’s perspective, updates usually mean changes and additions to the framework API. For that reason, besides the Android platform version numbers, a second version number, called the API level, is used to identify the framework API that is supported. Since April 2009, each Android version has been released under a codename based on desserts, such as Éclair, Froyo, and Gingerbread. This introduced a third versioning scheme to the Android platform, making things even more CHAPTER 1: Android Primer 3 cryptic for first-time Android application developers. When speaking of Android application development, you will often hear people say things like ‘‘my application requires Éclair and above,’’ ‘‘this method requires at least API level 9,’’ and ‘‘my phone got the Android 2.1 update.’’ Understanding which version and which API level they are referring to, as well as which new APIs are part of which Android platform version, can easily become a cumbersome memory exercise. You can use Table 1-1 as a reference to map between these three version schemes. NOTE: Since the Android platform is continuing to evolve, Table 1-1 may not cover the latest platform revisions. For an up-to-date listing, refer to the API Levels section of the Android Developer Pages, at http://developer.android.com/guide/appendix/api-levels.html. Table 1-1. Android Release Dates, Revisions, API Levels, and Codenames Release Date Platform Version API Level Codename November 5, 2007 Beta September 23, 2008 Android 1.0 1 February 9, 2009 Android 1.1 2 April 30, 2009 Android 1.5 3 Cupcake September 15, 2009 Android 1.6 4 Donut October 26, 2009 Android 2.0 5 Éclair December 3, 2009 Android 2.0.1 6 Éclair January 12, 2009 Android 2.1 7 Éclair May 20, 2010 Android 2.2 8 Froyo January 18, 2011 Android 2.2.1 8 Froyo January 22, 2011 Android 2.2.2 8 Froyo 4 CHAPTER 1: Android Primer Release Date Platform Version API Level Codename November 21, 2011 Android 2.2.3 8 Froyo December 6, 2010 Android 2.3 9 Gingerbread February 9, 2011 Android 2.3.3 10 Gingerbread July 25, 2011 Android 2.3.5 10 Gingerbread September 2, 2011 Android 2.3.6 10 Gingerbread February 22, 2011 Android 3.0 11 Honeycomb May 10, 2011 Android 3.1 12 Honeycomb July 15, 2011 Android 3.2 13 Honeycomb September 20, 2011 Android 3.2.1 13 Honeycomb August 30, 2011 Android 3.2.2 13 Honeycomb October 19, 2011 Android 4.0.1 14 Ice Cream Sandwich November 28, 2011 Android 4.0.2 14 Ice Cream Sandwich December 16, 2011 Android 4.0.3 15 Ice Cream Sandwich February 4, 2012 Android 4.0.4 15 Ice Cream Sandwich As shown in Table 1-1, there are 15 API levels that you should consider while developing your applications. The API level determines the size of your audience as well, so picking this number wisely is very important while developing a new Android application. The Android mobile phone market is highly fragmented. By simply looking at the release dates, you might think that most of the Android user base is running at least Android 3.0, since it has already been around for a year; however, this is not true. Due to the fragmentation, the release dates are far from giving a clear view of Android versions in use. Figure 1-1 is the latest version distribution chart from Android Platform Versions Dashboard (http://developer.android.com/resources/dashboard/platform- versions.html).

Description:
Android SDK provides the necessary code generators to translate programming interfaces that are defined in AIDL into Eclipse Workbench. You can open more than one Workbench at a time. To open a new Workbench, choose Window New Window. Perspectives. A perspective defines the set of
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.