Pages

Saturday, 18 August 2012

Create an Android Project & import samples with Eclipse

Building your own Android App

Welcome to Android Development Tutorial!

This Tutorial teaches you how to build your own (first) Android app. You’ll learn how to create an Android project and how to import the Android app’s project into Eclipse.
Before you start this Tutorial, be sure you have your android development environment set up.

 You need to:

- Download the Android SDK.
- Install the ADT plugin for Eclipse (if you’ll use the Eclipse IDE (.
- Download the latest SDK tools and platforms using the SDK Manager.
We discuss these steps in previous tutorial Android SDK tools and Installing Android ADT Plugin For Eclipse, once you've finished the setup; you're ready to begin this tutorial.
This tutorial teaches you some fundamental concepts about Android development, so it's important that you follow each step.

Creating Your First Android Application


You’ve downloaded the SDK, installed Eclipse, and plugged in the plug-in. You are now ready to start programming for Android. Start by creating a new Android project and setting up your Eclipse run and debug configurations, as described in the following steps.

Creating a New Android Project

To create a new Android project using the Android New Project Wizard, do the following:
- Select File -> New -> Project.
- Select the Android Project application type from the Android folder, and click next.
- In the wizard that appears, enter the details for your new project. On the first page, the Project Name is the name of your project file. You can also select the location your project should be saved.
The next step lets you select the build target for your application. The build target is the version of the Android framework SDK that you plan to develop with. In addition to the open sourced Android SDK libraries available as part of each platform release, Google offers a set of proprietary APIs that offer additional libraries (such as Maps). If you want to use these Google-specific APIs, you must select the Google APIs package corresponding to the platform release you want to target.
The final step allows you to specify the application properties. The Application Name is the friendly name for your application; the Package Name specifies its Java package; the Create Activity option lets you specify the name of a class that will be your initial Activity; and setting the Minimum SDK lets you specify the minimum version of the SDK that your application will run on.

Creating a New Android Project
Creating a New Android Project

Creating a New Android Project
Creating a New Android Project

Creating a New Android Project
Creating a New Android Project

Creating a New Android Project
Creating a New Android Project

    

More details about android PROPERTIES

Project Name: Provide any name of your choice here; I named it ‘Hello World’.
Build Target: This field asks you which version of Android do you want your App to target on. Check any one of your choice. Along with Target Name you can see the API Level (marked in the box) which is numbers representing the level of the Android API. This would be used to specify Min SDK Version field, which we’ll know in few seconds.
Application Name: This is a name which you’d want to give to your final Application. This would be displayed in the phone’s menu and also on title bar of App. You may provide any name of your choice. It's not a mandatory field.
Package Name: This gives a package structure to your App. If you are familiar to java you probably already related it to java package, which is absolutely correct. You may name it anything like ‘android.firstApp’ or ‘com.apps.android.firstApp’. The dots in the package name just provide a hierarchical structure to app.  The package name must have at least two identifiers (dot separated). It's a required field.
Create Activity: We discuss Activities in this tutorial Android Application User Interface tutoril  , but for now I'd like you to know that every App’s function is treated as an activity in android, and you can give a name to your activity. You can have activities and sub-activities in your apps. Again, this is not a mandatory field. Note: It won't allow spaces in this field.
Min SDK Version: Do you remember, we came across this name while talking about ‘Build Target’. This field tells your app to put an extra check on the application that it is only focused on some minimum level of Build Target. This field takes in numeric value corresponding to the API Level of Build target. It would specify that if any target environment is below this Min SDK Version, then this application won't work. This ideally should be equal to the API Level value of the Build Target selected above by you. But this is not a Mandatory field, and so even if you give any other version, it would accept it with a warning message.

The Summary of android PROPERTIES

Project name: The name of the project
Application name: A user-friendly name for your application
Package name: The name of the package. You should use a reverse domain name for this.
Create Activity: The name of the first activity in your application
Min SDK Version: The minimum version of the SDK that your project is targeting

Import the app’s Android project into Eclipse

-  Opening  the Import  Dialog then  Select  File ->  Import…  to  open  the  Import  dialog
- Importing your app’s project (sample code).  In the Import dialog, expand the General node and select Existing Projects into Workspace, then click Next -> to proceed to the Import Projects step. Ensure that Select root directory is selected, and then click the Browse button. In the Browse for Folder dialog, locate the sample folder, select it and click OK. Click Finish to import the project into Eclipse. The project now appears in the Package Explorer window at the left side of the Eclipse window.
Import the app’s Android project into Eclipse
Import the app’s Android project into Eclipse

Import the app’s Android project into Eclipse
Import the app’s Android project into Eclipse

  


No comments:

Post a Comment