Wednesday, 6 May 2009

Android App : MoneyTracker

Here's my first (public) Android app:
http://files.brindy.org.uk/MoneyTracker.apk

And here's the source:
http://github.com/brindy/MoneyTracker/tree/master

Basically you can specify a 'disposable' amount and then add expense items showing you how much is remaining. That's it, pretty noddy. It isn't a million miles from the notepad tutorial, the most significant difference being that I use db4o as the data storage instead of SQLLite. Unfortunately, that increases the apk file from 20k to 413k, but I am going to investigate getting that down to something more reasonable.

That said, being able to use db4o is much nicer than having to mess about with database tables and SQL. I had to write my own

I haven't actually tried this on an Android device yet, as I don't own one, so if someone wants to give it and try and let me know how it goes, I'd be grateful.

Obvious disclaimers apply - if your phone goes kaput, don't blame me. :)

This is also my first foray in to using Git and github.com, which so far has been relatively easy to get on with. I guess I should have tagged/forked/branched(?) my changes from SQLLite to db4o, but I don't really know how just at the moment.

One of the things you get out of the box when using SQLLite is the ability to use the SimpleCursorAdapter which automatically maps some given data to the views in a layout. I of course had to do this manually, but given the number of lines of code I'd deleted because of using db4o adding these few lines of code was not a problem.

3 comments:

nikolar said...

Much! simpler and nicer than the SQLite version. SQLite was certainly a good choice for an embedded RDBMS, but it would be nice to have optimized db4o available as well. If you look at the architecture at http://developer.android.com/guide/basics/what-is-android.html you'll see how how deep in it SQLite is. I'm sure that lots of the core libs and app f/w has been written with the SQLite in mind. It's probably up to Google to really embed some sort of object DB into Android. I don't know if its possible to extend the app f/w without forking the whole OS?
Since ContentProviders provide data in the tabular format, they are out of the question.. What other options there are, to exchange data with an db4o service?

Chris Brind said...

I'm not sure there are (m)any options at the moment.

As it happens I feel the footprint of db4o is too big to be useful in an actual Android application. However, I didn't want to use SQLite so I created a an abstraction layer to handle simple Object Serialisation, easily replacable with db4o later. (The version of MoneyTracker on the Android Market is using the object serialization method.)

The db4o team are going through a process of modularising db4o so I'm hoping to see a vastly reduced db4o footprint in the future.

Pavel Lahoda said...

Hi, I just posted a comment at the db4o site that might help you to get the footprint of your application down :

http://developer.db4o.com/forums/55881/ShowThread.aspx#55881

Let me know if this might work for you.

Cheers,

Pavel