- Open Eclipse and select from the menu File>New>Android Project, you’ll see a window like this.
- Now there are several fields that appear here they are:
Project Name: The Eclipse project name, the name of the folder that will hold the project files.
Application Name:The name of the application that will appear on the phone.
Package Name: The package name space, it sould be in the form of [abc].[xyz].
Create Activity: the name of the basic activity class of your application. it’s optional to create.
Min SDK Version: the minimum API level required by the application. You see in the Build Target list there is a list of the available SDK versions to use for the application and in front of each one the corresponding API level. You must ensure that you application API level is supported b the device. - Press Finish then press run and choose run as Android Application, the emulator will start, wait until the main screen appears, unlock by pressing the menu button then you should see something like this
Notice: the emulator may take a long time to boot so please be patient.
- Now go to the package explorer on the left bar of eclipse to your project
folder navigate to src/[PackageName]/HelloAndroid.java this is the main activity class of your application. It should be like this:
package mina.android.helloandroid; import android.app.Activity; import android.os.Bundle; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } }
- We will explain what each line in this code means later but now let’s understand what each folder in our project contains.
- The project contains the following folders
Folder Name
Description
Required
src
Contains all the source code (class files) for the project
Yes
gen
Contains the R.java class file
Generated automatically
Android 1.5
Its name changes according to the sdk version you use (1.5 here). Contains the Android API class files packed in android.jar files
Generated automatically
assets
You can place any external resources (text files,images,…) in this folder. It’s much like the res file except it’s more like the file system where you put files that you want to access them as raw bytes
no
res
Contains resources for the application
Yes
drawable
Contains the images required for you application. You can add your own image files to this folder
No
Layout
Contains the main.xml file that defines the view that construct the User Interface of the application
No
Values
Contains other resources that can be used for your application such as string resources, styles or colors
No
- So that was a quick look on the android project structure, in this post we will take a deeper look on the hello Android application.
Android, Android Apps, Best Android Apps, Android phones, Android Applications, Samsung, Samsung Galaxy, Nexus, Google, HTC, LG, Smartphones, Android News
Sunday, January 17, 2010
Hello Android
Now we’re going to explore our first Android application which will be the famous Hello World application. We are going to explain the structure of an Android application and some of the basic concepts wee must understand
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment