Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

* * * * * 1 votes

Getting Started Android 2.2


  • Please log in to reply
No replies to this topic

#1 Rakso


    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 335 posts
  • Programming Language:PHP, JavaScript
  • Learning:C++, PHP, Python, JavaScript

Posted 06 January 2012 - 03:28 PM

What is Android?
Android is a linux based operative system for mobile devices such as tablets and smartphones. Android is currently owned by Google and its an unique project because its in active developement & Google gives it away for free to hardware manufacturers and phone carriers who want to use Android on their devices.
The source code of the Android operative system is available to everyone for free, You as private person could dowload it and create your own custom version of the operative system but this is a very hard task so we will skip it for now.

The thing about Android most developers are after is to release their own applications for the operative system, Applications such as games or something like a calculator.
What i want to teach today is about how to get started with creating Android applications. So this wont be too advanced.

What do i do now?
The first thing you need before developing apps is the SDK (Software Development Kit) and the IDE(Integrated development environment) to work on. We start with dowloading an application called Eclipse you can download it from this website:Eclipse Downloads
Download the one that says "Eclipse IDE for Java Developers"
There is no install required for Eclipse its just download and run from the eclipse.exe file inside the folder you get when downloading.

We also need to download the SDK for Android to be able to create the Android apps, You can download it from here: Android SDK | Android Developers (I recoment the .exe file if you're from windows computer)

Place the Android SDK that you downloaded in some location on your computer where you can remember it.
If you downloaded the .exe file(Windows) go ahead and run it.

If you get a message saying that the JDK is missing go to this page and download the JDK:Java SE Downloads

After you installed the Android SDK please remember the directory you installed it too.

After you downloaded both you can go ahead and start the Eclipse application we want to setup the ADT (Android Development Tools)

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:
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.
And then..
9. Select Window -> Preferences... to open the Preferences panel (Mac OS X: Eclipse -> Preferences).
10. Select Android from the left panel.
11. 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.

For the SDK Location in the main panel, click Browse... and locate your Android SDK directory.
Click Apply, then OK.

The last step
The last step in setting up your Android SDK is using the Android SDK and AVD Manager (a tool included in the Android SDK starter package) to download essential Android SDK components into your development environment.

You can launch the Android SDK and AVD Manager in one of the following ways:

1. From within Eclipse, select Window -> Android SDK and AVD Manager.
2. On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
3. On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute:

This will open a graphical UI to let you choose what repositories to download. My personal recomendation is to check the checkbox for "Android Repository" And download everything that is inside.. It can be usefull in later developement.

Creating a new AVD
AVD is an Virtual Device of an Android phone, It lets you run a Android phone on your computer like an emulator, Realy cool!

1. In Eclipse, click the Window menu, then click Android SDK and AVD Manager.
2. On the Android SDK and AVD Manager dialog that pops up, you'll see a list of any Android AVDs you have already created, If you didn't do anything with this before it should be clean and have no virtual devices inside of it.
3. click the "New" button here to start creating a new AVD.
4. Give your AVD a name (Example: MyAndroid)
5. Select target Android 2.2 (Its the most used currently)
6. Leave the rest as default. And click finish.

In the list that was empty before should now exist a new AVD with your name and target version.

We're finished installing, Now what?
Now we will create our first project and run it. Just to see how it works.

Creating the first project.
1. Create a new Project File -> New -> Project , a new window should appear to select project type.
2. Select Android Project from Android and click Next.
3. Now you are to specify Project Name. A directory with this name will be created.
4. Select the target version choose 2.2 for this app (Its most used.
5. Give the app an application name (The one that will be displayed in the menu of the Android phone)
6. Next is the Package Name the namespace actually where all your code will go. (I would do something like com.TheCompBoy
6. Then Activity Name it is the name of the class that is created.
7. My SDK version, Type in the number of the target version you checked it says API and then a number if you picked 2.2 it should be number 8
8. Click finish.

Here is my settup for this, If you are unsure about how you should do it just follow what i wrote here:

Run your application
Press the play button that eclipse has. It might pop up a window for you to decide what AVD to run from, If it does just select the one that you created.

Im serious about creating apps i want to learn more!
I would recoment buy a book or get one from the library.
Here is my list of my recomended books:
1. Professional Android 2 Application Development, By Reto Meier
2. Hello, Android: Introducing Google’s Mobile Development Platform, By Ed Burnette
3. Beginning Android 3, By Mark Murphy
4. Pro Android 3, By Satya Komatineni, Dave MacLean, and Sayed Hashimi

Thanks for reading the tutorial!

Edited by TheCompBoy, 07 January 2012 - 01:40 AM.

  • 0

I am a freelance web developer & web designer. I loves to make websites and would be happy to work with you.

Check out my portfolio: http://oskarmendel.me/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download