Tuesday, December 30, 2008

My First Android Application - Overview

I pre-ordered a Kogan Android phone early in December and wanted to start writing an application for it.

As with any software project, you need a mission or an objective so I decided to port the application I wrote in the CakePHP framework for keeping track of our movies to the Android framework.

My wife and I collect movies and we watch them all quite regularly. We also loan them out to various people and it's easy to loose track of who has what.

One of the problems I have with the application is that it is _NOT_ available when we are actually in the store seeing as it is being hosted on the server in my garage. Porting this to the hand-held made perfect sense.

I started by going over all the android samples on their notes database and from there, I expanded on the idea to include movies and such.

The application consists of 3 main activities (Main, Edit Movie, Import Movies).

The Main activity is a ListActivity which uses a custom CursorAdapter to display the list of movies along with an icon next to each movie indicating DVD or BlueRay. Since the official logos are trademarked, I had to use ones I found online in the Silk icon set:

public class MyMoviesPanelAdapter extends CursorAdapter { //[,,] }

And the backend database is SQLite which is included in the Android API's and allows relational data to be stored on the mobile.

The result is this:

And here with the menu visible:

Next, I had to create an additional activity that woudl allow new movies to be created along with the editing of existing movies. This was a simple activity and I used a TableLayout for placing the widgets on the screen so I could get the boxes to line up nicely:

And once again, here with the menu visible:

Once I was done with the basic CRUD functionality, I had to get my existing collection in the device somehow. I found a greate sample application for browsing through your mobile filesystem and I extended that to parse a CSV file and import the data into the database.

What's next? Well, I want to integrate this application with the devices contact list for rentals. So you know who has your movies, and even some type of "Send SMS/Email" to pester people if they haven't returned your movies in time. Possibly even a background agent that will notify you at set intervals (2 weeks, etc). I might also remove the movie specific functionality and allow the app to track video games and such.

Ive published the application to the Android market and hopefuly I'll get some good feedback.