Skip to content

My first learning log for developing android apps

January 31, 2011

I followed the rave short course instructions,  it took a few hours to download and install Eclipse, Android ADT plugin and SDK, I managed to set the environment up with ease.

I then created a hello world application, by following the tutorial this gave me an understanding of running an app the structure of an android project file in eclipse.

Then I went on to the next exercise using the Google MAP API. To get the key, I followed the instruction and now have a Google maps API key, this process was unfamiliar, I didn’t really understand what I was doing but it worked.

I was unable to get the exercise to work at first the code was showing up some errors, but I got it to work the following day, after doing the these tutorials

The problem I was having was with coordinates, I kept on getting  a point in the ocean around Greenland, after restarting eclipse it worked, I spent about 2 hours on this but I now understand this part of the code much more. I added the following into the rave short courses code, to get a specific location. It took me a while to extract coordinates from Google maps as they hide them. Once I found the longitude and latitude, the values needed to be converted into Micro degrees, I used this mobiforge code to do the conversion.

Here is the code I added to get the location of the London 2012 site in Stratford

double lat = (51.537167);
double lng = (-0.01502);

GeoPoint point = new GeoPoint((int)(lat * 1e6), (int)(lng * 1e6));

mMapView.getController().animateTo(point);

To complete the exercise I needed to incorporate the following code, which I was unable to get to work.


@Override
public boolean onKey(View view, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_N) {
mMapView.setSatellite(false);
}
if (keyCode == KeyEvent.KEYCODE_Y) {
mMapView.setSatellite(true);
}
if ((keyCode >= KeyEvent.KEYCODE_0) && (keyCode <= KeyEvent.KEYCODE_9)) {
mMapView.getController().setZoom(20 - keyCode + KeyEvent.KEYCODE_0);
}
return false;
}


Here is my Google maps app that shows the position of the London 2012 site in Stratford

London 2012 map

As part of my project exploration I wanted to see how easy it was to add a RSS feed in to a web app, I found some example code and explanation –

I downloaded and imported the project in to eclipse and ran it, (managed to do this without any instructions, this shows my learning is progressing)

Then changed a few parameters:

  • Changed the feedURL in feedPaserFactory
  • static String feedUrl = "http://www.london2012.com/news/news.rss";

  • Changed the app name to London 2012  in  strings.xml

<string name="app_name">London 2012</string>

  • Also the text was quite crowded, so I increased the padding and spacing. I added this code in to row.xml

android:padding="15dp"

android:textSize="21sp"

  • I also wanted to show only the 10 most recent news stories I have not figured this out yet
  • I changed the icon, to do this I created a new png, named it icon2, placed it in the same folder as the current icon and then changed this line of code in AndroidManifest.xml

  • There is a menu for changing feeds sources, I would like to make my own customised menu, I need to do a tutorial on this functionality first
  • I want to change the roll over colour, need to find the setting

So here is what the RSS app looks like with my changes.

London 2012 News

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: