Biyernes, Enero 25, 2013

Creating a New Project



Creating a New Project




In Eclipse, choose File→New→Android Project. Sometimes (especially the first time you
run Eclipse) the Android tools may not be appear there right away. They should show
up in the future after you’ve used them for the first time. If Android Project is not an
option under File→New, choose Other and look for Android Project in there.


In the new project dialog window, fill out the following:

1. “Project name” is an Eclipse construct. Eclipse organizes everything into projects.
   A project name should be one word. I like to use the CamelCase naming convention
   here. Go ahead and type HelloWorld.
2. Next, you need to choose the build target. The build target tells the build tools
   which version of the Android platform you are building for. In here you should see
   a list of available platforms and add-ons you have installed as part of your SDK.
   Go ahead and pick one of the newer ones, such as Android 2.2 (but don’t choose
   the targets named Google APIs—those are Google’s proprietary extensions to the
   Android platform). For our purposes, we’ll stick to Android Open Source versions
   of the Android platform.
3. You need to fill out your project properties next. The application name is the plain
   English name of your application. Go ahead and enter something like Hello,
   World!!!.
4. The package name is a Java construct. In Java, all source code is organized into
   packages. Packages are important because, among other things, they specify the
   visibility of objects between the various Java classes in your project. In Android,
   packages are also important for application signing purposes. Your package name
   should be the reverse of your domain name with optional subdomains. I might use
   com.example.calculator if I were building a calculator app and my domain name
   was example.com. I’m going to be using com.marakana for my package name here.
5. You can optionally specify an activity. I haven’t covered activities yet (you’ll learn
   about them in Chapter 6), but think of them as corresponding to the various screens
   in your application. An activity is going to be represented by a Java class, and
   therefore its name should adhere to Java class naming conventions: start with an
   upper-case letter and use CamelCase to separate words. So, type HelloWorld for
   your activity name.
6. The minimum SDK version is the minimum version of Android—as represented
   by API level—that is required for the device to run this application. You want this
   number to be as low as possible so that your app can run on as many devices as
   possible. I’m going to put 8 here to represent Android 2.2, which I know I have
   installed.


Finally, click on the Finish button, and Eclipse will create your project. Let’s look at
the various files that this process created.

Walang komento:

Mag-post ng isang Komento