Getting started with the Android SDK

by Randall 11/1/2009 11:07:00 PM

After putting off Android for quite some time, I finally decided to dig in.  I must admit, however, that it was Verizon's clever marketing campaign in coordination of the upcoming launch of the Verizon Droid that motivated me enough to do it.  For the last year or so I've had friends and family memers mention on occasion that I 'should' be developing applications for the iPhone (perhaps they're all thinking that I'll strike gold and share some moola), but I never could motivate myself.  First of all, I'm not an Apple fanboy.  Secondly, I don't own a Mac so that kind of kills it.  Apple has seen to it to exclude Windows developers from getting in on the action.  Android and Google is a completely different story.

The Android SDK plugs into the Eclipse IDE quite seamlessly.  I was able to get Eclipse and the Android SDK installed, updated, configured, and ran my initial "Hello World" application within about an hour.  Since Eclipse runs on Windows (as well as Linux and Mac), I was able to dig right in.  Kudos to Google.

Let's see what it's all about.

The best place to start is right here: http://developer.android.com/sdk/index.htm

I'm not going to reproduce their work, so let's get right to how things look (this is running on a fresh install of Windows 7) ...

Running the AVD



... still booting ... 



... and still booting ... 



The whole bootup process takes far too long.  I have yet to be able to find a way to shorten it.  Unfortunately, every time you make a code change and want to run your application, you must wait for about 1 min or so for the AVD to fire up.  Unless I've just not found it, this is a step back from developing against the .Net CF as the emulators there enter a standby mode when you stop debugging.  ***EDIT*** You do not need to shut down the emulator in order to deploy new code.  Simply minimize the AVD, make your code changes, then run the application via Eclipse.  The updated application will run correctly.

"Hello, Android!"

According to Google's "Hello World" tutorial, you can simply change this:


to this ...


... and Voila! But this DOES NOT work. At first glance it (seemingly) works, but change the argument of setText to "Howdy, Android" and you will still get "Hello, Android" when you run the AVD. I tried several times recompiling my code. Nothing worked.

To resolve this, you need to understand that Android applications support two ways of building the user interface: through code and XML files1. If you browse to 'res/layout/main.xml' and "Open with XML Editor", you'll see the following:


The key here (literally) is in the @string/hello. Now open 'strings.xml' and find the Resource Element called 'hello' which is being referenced here. If you change the value here to something else, it will work.

 

Run your application again (and wait, and wait, and wait) ...

 

Nothing dramatic yet.  Just getting up and going.  Perhaps someone else had or will have the same issue and this will help.  Tell me if you know how to speed up running the apps on the AVD.

More to come on this.

Sources: 1. "Getting Started with Android Development Using Eclipse", September 15, 2008, Wei-Meng Lee, http://www.devx.com/wireless/Article/39101

 

Currently rated 3.3 by 6 people

  • Currently 3.333333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Related posts

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

4/16/2014 9:08:19 PM

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen

About the author

Name of author Randall Sexton
Currently a .Net developer for Bechtel Corporation in Oak Ridge, TN.

E-mail me Send mail

Calendar

<<  April 2014  >>
MoTuWeThFrSaSu
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

View posts in large calendar

Pages

    Recent comments

    Don't show

    Authors

    Categories


    Logo Credit

    My logo was taken from CodingHorror.
    Jeff Atwood © Copyright 2007

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2014

    Sign in