Explore

Loading

Friday, February 10, 2012

Exploring the Android Project Files

.
AndroidManifest.xml—The central configuration file for the application.
.
ADT plug-in. Do not edit this file.
default.properties—A generated build file used by Eclipse and the Android
.
Android ADT plug-in. Edit this file to configure your code optimization and
obfuscation settings for release builds.
proguard.cfg—A generated build file used by Eclipse, ProGuard, and the
.
/src folder—Required folder for all source code.
.
application, named
default launch activity in the Android manifest file.
/src/com.androidbook.droid1/DroidActivity.java—Main entry point to thisDroidActivity. This activity has been defined as the
.
source file. Do not edit this file.
/gen/com.androidbook.droid1/R.java—A generated resource management
.
in the project.
/assets folder—Required folder where uncompiled file resources can be included
.
Application resources include animations, drawable graphics, layout files,
data-like strings and numbers, and raw files.
/res folder—Required folder where all application resources are managed.
.
sizes for different device screen resolutions.
/res/drawable-*—Application icon graphic resources are included in several
.
organize controls on the main application screen.
/res/layout/main.xml—Layout resource file used by DroidActivity to. /res/values/strings.xml—The resource file where string resources are defined

Thursday, February 9, 2012

Developing Android Projects

Open Eclipse and follow these steps to create a new project:

1.
on the Eclipse toolbar.

The first time you try to create an Android Project in Eclipse, you might need to
choose File, New, Project… and then select the Android, Android Project. After you
have done this once, it appears in the Eclipse project types and you can use the
method described in Step 1.

2.

3.
select the Create New Project in Workspace radio button.

4.
select the version of Android most appropriate for the devices used by your
target audience and the needs of your application. If you are planning to use
the Google add-ons (for example, Google Maps), be sure to choose the Google
APIs version for your target platform. For this example, the Android 2.3 (API
level 9) build target is sufficient.
Select a build target for your application. For most applications, you want to

5.
call the application
Specify an application name. This name is what users will see. In this case,Droid #1.

6.
for Java. Because all code in this book falls under the
Specify a package name, following standard package namespace conventionscom.androidbook.*
namespace, use the package name
com.androidbook.droid1.

7.
default launch
Check the Create Activity check box, which instructs the wizard to create aActivity class for the application. Call your activityDroidActivity

8.
the build target by default (for example, Android 2.3 is API level 9). If you want to
support older versions of the Android SDK, you need to change this value. For example,
to support devices with Android 1.6, set the Min SDK Version to API Level 4.
Confirm that the Min SDK Version field is correct. This field is set to the API level of

9.
Click the Next button.

10.
with your Android application. For this example, a test project is unnecessary.
However, you can always add a test project later by clicking the Android Test
Project creator icon, which is to the right of the Android Project Wizard icon
( ) on the Eclipse toolbar.

The Android project wizard enables you to create a test project in conjunction11. Click the Finish button.
.
Choose a location for the project source code. Because this is a new project,
Choose a project name. In this case, name the project Droid1.
Choose File, New, Android Project or click the Android Project creator icon

Eclipse for android

Begin by writing a simple Android “Hello, World” application that displays a line of
text to the user. As you do so, you will also take a tour through the Eclipse environment.
Specifically, you will learn about some of the features offered by the Android
Development Tools (ADT) plug-in for Eclipse. The ADT plug-in provides functionality
for developing, compiling, packaging, and deploying Android applications.
Specifically, the ADT plug-in provides the following features:
The Android Project Wizard, which generates all the required project files
  • .
  • Android-specific resource editors including a Graphical Layout editor for designing Android application user interfaces
  • .
  • The Android SDK and AVD (Android Virtual Devices) Manager
  • .
  • The Eclipse DDMS perspective for monitoring and debugging Android applications
  • .
  • Integration with the Android LogCat logging utility
  • .
  • Integration with the Android Hierarchy Viewer layout utility
  • .
  • Automated builds and application deployment to Android emulators and handsets
  • .
  • ProGuard support for code optimization and obfuscation
  • Application packaging and code-signing tools for release deployment, including
    Familiarizing Yourself with Eclipse

    Getting Started with Android

    What you need to do???

    Prepare your development computer and ensure it meets the system requirements.

    • First of all you need a IDE(Netbeans,Eclipse ect)in your system.
    • Download and install any of them.
    • Better to use eclipse,because today this is the standard IDE in the industry.
    • Download the android SDK from developer.android.com
    • Install the ADT Plugin for Eclipse (if you'll be developing in Eclipse).
    • Add Android platforms and other components to your SDK.
    Installing SDK

    The SDK starter package is not a full development environment—it includes only the core SDK Tools, which you can use to download the rest of the SDK components (such as the latest Android platform).

    If you downloaded a .zip or .tgz package (instead of the SDK installer), unpack it to a safe location on your machine. By default, the SDK files are unpacked into a directory named android-sdk-<machine-platform>.
    If you downloaded the Windows installer (.exe file), run it now and it will check whether the proper Java SE Development Kit (JDK) is installed (installing it, if necessary), then install the SDK Tools into a default location (which you can modify).
    Make a note of the name and location of the SDK directory on your system—you will need to refer to the SDK directory later, when setting up the ADT plugin and when using the SDK tools from the command line.

    Installing the ADT Plugin for Eclipse

    1. Start Eclipse, then select Help > Install New Software....
    2. Click Add, in the top-right corner.
    3. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location:
      https://dl-ssl.google.com/android/eclipse/
    4. Click OK Note: If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons).
    5. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
    6. In the next window, you'll see a list of the tools to be downloaded. Click Next.
    7. Read and accept the license agreements, then click Finish. Note: If you get a security warning saying that the authenticity or validity of the software can't be established, click OK.
    8. When the installation completes, restart Eclipse.

    Configuring the ADT Plugin

    After you've successfully downloaded the ADT as described above, the next step is to modify your ADT preferences in Eclipse to point to the Android SDK directory:

    1. Select Window > Preferences... to open the Preferences panel (Mac OS X: Eclipse > Preferences).
    2. Select Android from the left panel.
    3. You may see a dialog asking whether you want to send usage statistics to Google. If so, make your choice and click Proceed. You cannot continue with this procedure until you click Proceed.
    4. For the SDK Location in the main panel, click Browse... and locate your downloaded SDK directory.
    5. Click Apply, then OK.

    Adding Platforms and Other Components

    The SDK uses a modular structure that separates the major parts of the SDK—Android platform versions, add-ons, tools, samples, and documentation—into a set of separately installable components. The SDK starter package, which you've already downloaded, includes only a single component: the latest version of the SDK Tools. To develop an Android application, you also need to download at least one Android platform and the associated platform tools. You can add other components and platforms as well, which is highly recommended.

    You can launch the Android SDK and AVD Manager in one of the following ways:
    • From within Eclipse, select Window > Android SDK and AVD Manager.
    • On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
    • On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute:
      android

    What is android?

    In 2007, the Open Handset Alliance announced the Android platform and launched
    a beta program for developers. Android went through the typical revisions of a new
    platform. Several prerelease revisions of the Android Software Development Kit
    (SDK) were released. The first Android handset (the T-Mobile G1) began shipping in
    late 2008. Throughout 2009 and 2010, new and exciting Android smartphones
    reached markets throughout the world and the platform proved itself to industry
    and consumers alike. Over the last three years, numerous revisions to the Android
    platform have been rolled out, each providing compelling features for developers to
    leverage and users to enjoy. Recently, mobile platforms have begun to consider
    devices above and beyond the traditional smartphone paradigm, to other devices
    like tablets, e-book readers, and set-top boxes like Google TV.
    As of this writing, hundreds of varieties of Android devices are available to consumers
    around the world—from high-end smartphones to low-end “free with contract”
    handsets and everything in between. This figure does not include the numerous
    Android tablet and e-book readers also available, the dozens of upcoming
    devices already announced, or the consumer electronics running Android. (For a
    nice list of Android devices, check out this Wikipedia link: http://goo.gl/fU2X5.)
    There are more than 200,000 applications currently published on the Android
    Market. In the United States, all major carriers now carry Android phones prominently
    in their product lines, as do many in Asia, Europe, Central/South America,
    and beyond. The rate of new Android devices reaching the world markets has continued
    to increase.
    Google has been a contributing member of the Open Handset Alliance from the
    beginning. The company hosts the Android open source project as well as the developer
    website at http://developer.android.com. This website is your go-to site for
    downloading the Android SDK, getting the latest platform documentation, and
    browsing the Android developer forums. Google also runs the most popular service
    for selling Android applications to end users: the Android Market.

    Wednesday, February 8, 2012

    Google and the Open Handset Alliance

    In 2007, a group of handset manufacturers, wireless carriers, and software developers
    (notably, Google) formed the Open Handset Alliance, with the goal of developing the next
    generation of wireless platform. Unlike existing platforms, this new platform would be
    nonproprietary and based on open standards, which would lead to lower development
    costs and increased profits. Mobile software developers would also have unprecedented
    access to the handset features, allowing for greater innovation.