Вы находитесь на странице: 1из 5

Android 101: System Setup | Javalobby

http://java.dzone.com/articles/android-101-system-setup

Login Join DZone About the author First Name: James Last Name: Sugrue Zone Leader Posts:
Login
Join DZone
About the author
First Name: James
Last Name: Sugrue
Zone Leader
Posts: 417
Joined: 09/21/2005
View full user profile
Spotlight Features
HTML5: The Interactive Web
Highlights the new features in HTML5
and illustrates the JavaScript APIs
available to work with those features.
Solr: 'Search' for the
Enterprise
Develop high performance search
applications with faceting, dynamic
clustering, database integration and
more.
Lazy Loading - From Java to
Flex
Sending complex object graphs from
Java to Flex can be problematic. Learn
how lazy loading can be more
effective.
Popular at DZone
Activiti 5 with Spring Integration 2.0 Mail Adapter
SOAP and REST are not interchangeable
Google's Guava Library Tutorial Part 5: Back to the
Primitive(s)
Tim Bray · What Android Is
Start using JBPM fast and easy
Wasting Your Time By Not Writing Tests | Tomek's
blog
PrimeFaces 2.2.RC2 Released
See more popular at DZone
Subscribe to the RSS feed
See more popular at DZone Subscribe to the RSS feed Home The heart of the Java

Home

See more popular at DZone Subscribe to the RSS feed Home The heart of the Java

The heart of the Java developer community

Library

Refcardz

Forums

Links

Zones

ITQuestions

Snippets

Contribute

Refcardz Forums Links Zones ITQuestions Snippets Contribute Home 12 Android 101: System Setup 1 Submitted by

Home

12 Android 101: System Setup

1 Submitted by James Sugrue on Wed, 2010/10/06 - 10:27am

1 Submitted by James Sugrue on Wed, 2010/10/06 - 10:27am Tags: Mobile We Recommend These Resources
1 Submitted by James Sugrue on Wed, 2010/10/06 - 10:27am Tags: Mobile We Recommend These Resources
1 Submitted by James Sugrue on Wed, 2010/10/06 - 10:27am Tags: Mobile We Recommend These Resources
1 Submitted by James Sugrue on Wed, 2010/10/06 - 10:27am Tags: Mobile We Recommend These Resources
1 Submitted by James Sugrue on Wed, 2010/10/06 - 10:27am Tags: Mobile We Recommend These Resources

Tags:

Mobile

by James Sugrue on Wed, 2010/10/06 - 10:27am Tags: Mobile We Recommend These Resources Getting Started

We Recommend These Resources

Getting Started with FUSE ESB 4 Tutorial: Use

Case 4

Getting Started with FUSE ESB 4 Tutorial: Use

Case 2

Getting Started with FUSE ESB 4 Tutorial:

Building, Installing and Running FUSE

Getting Started with FUSE ESB 4 Tutorial: Use

Case 1

Introduction to Apache Camel

In the previous article in this series, we looked at the basic

concepts of the Android architecture. In this article, we'll look at

how to get Android setup on your system. I'll make the assumption that you already have Java 5+ installed. To make life easier for

yourself, you should also have Eclipse installed as your

development IDE.

Setting Up The Android SDK

Download the Android SDK from http://d.android.com

/sdk/index.html.

Once downloaded, extract the zip file to a location on your

hard drive. Optionally, you can add the location of the SDK to your system PATH.

Run the SDK setup program. On Windows, this will be SDK Manager.exe while on other platforms you will need to run tools/android. This program will allow you to install SDK components such as documentation, platforms, add-on

libraries and USB drivers.
libraries and USB drivers.

Typically you will want to select everything here so that you can write applications for any Android target.

Development Tools

The next part of your setup is to install the Android Development Toolkit in your Eclipse instance. The best way to do this is

to use the Update Manager under the Help/Install New Software menu. Just add a new update site pointing to https://dl-

ssl.google.com/android/eclipse.

menu. Just add a new update site pointing to https://dl- ssl.google.com/android/eclipse . 1 of 5 11/24/2010

Android 101: System Setup | Javalobby

http://java.dzone.com/articles/android-101-system-setup

http://java.dzone.com/articles/android-101-system-setup Once the install completes you'll need to restart

Once the install completes you'll need to restart Eclipse.

Your First Android Project

Now you're ready to really get into Android development.

First you'll have to let Eclipse know where to find the Android SDK. Go to the preferences dialog, and click on the Android item to do this:

dialog, and click on the Android item to do this: Your one last step is to

Your one last step is to ensure you have an AVD (Android Virtual Device) from which to run your application. You can do this from the AVD manager:

Android 101: System Setup | Javalobby

Android 101: System Setup | Javalobby When you use the New Project wizard, you'll have the

When you use the New Project wizard, you'll have the option to create an Android project:

you'll have the option to create an Android project: From here you can create a project

From here you can create a project that has a particular Android SDK targetted:

http://java.dzone.com/articles/android-101-system-setup

Android 101: System Setup | Javalobby

http://java.dzone.com/articles/android-101-system-setup

http://java.dzone.com/articles/android-101-system-setup If you click on next, you will also be able to create an

If you click on next, you will also be able to create an Android test project that will allow you to test out your app.

Inside the project you will see the source for your newly created activity:

01.

package com.dzone.android.app;

02.

03.

import android.app.Activity;

04.

import android.os.Bundle;

05.

06.

public class FirstActivity extends Activity {

07.

/** Called when the activity is first created. */

08.

@Override

09.

public void onCreate(Bundle savedInstanceState) {

10.

super.onCreate(savedInstanceState);

11.

setContentView(R.layout.main);

12.

}

13.

}

We'll change this around a little, creating our own view to use:

01.

package com.dzone.android.app;

02.

03.

import android.app.Activity;

04.

import android.os.Bundle;

05.

import android.widget.TextView;

06.

07.

public class FirstActivity extends Activity {

08.

/** Called when the activity is first created. */

09.

@Override

10.

public void onCreate(Bundle savedInstanceState) {

11.

super.onCreate(savedInstanceState);

12.

TextView view = new TextView(this);

13.

view.setText("A New App");

14.

setContentView(view);

15.

}

16.

}

"A New App" ); 14. setContentView(view); 15. } 16. } 4 of 5 11/24/2010 2:56 PM
"A New App" ); 14. setContentView(view); 15. } 16. } 4 of 5 11/24/2010 2:56 PM

Android 101: System Setup | Javalobby

http://java.dzone.com/articles/android-101-system-setup

To see if this works, click on Run As / Android application. This will launch the Android emulator and start up your newly created application

Android emulator and start up your newly created application Now that you've got your system properly

Now that you've got your system properly set up, the next few articles in this series will bring you through the process of writing your own application.

Your rating:

James is a DZone Zone Leader and has posted 417 posts at DZone. You can
James is a DZone Zone Leader and has posted 417 posts at DZone. You can
James is a DZone Zone Leader and has posted 417 posts at DZone. You can

James is a DZone Zone Leader and has posted 417 posts at DZone. You can read more from them at their website.

James is a DZone Zone Leader and has posted 417 posts at DZone. You can read

Login or register to post comments

3793 reads

Printer-friendly version

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Advertising - Terms of Service - Privacy - © 1997-2010, DZone, Inc.