Archive

Posts Tagged ‘xml’

Pictures and Persistence

December 27, 2009 Leave a comment

It looks like I’m finally getting close to an app with a decent set of functionality now.  Recently I’ve been doing a lot of work on being able to save and reload an Excursional trip, as well as adding geotagged pictures into the mix.

For persisting trip data, I chose to store it all in fairly simple XML files.  This is what lead me to my first major disappointment with Android; the lack of the javax.xml.transform package in the Android SDK.  One of the most common ways to write an XML file in Java is to create an org.w3c.dom.Document object, then write it out as a String with the help of the transform package.  Without it, I was forced to create my own simple xml “toString”.

Although having to write this myself wasn’t all that much of a hardship, I was quite surprised that Google decided to leave functionality for a fairly common task out of the SDK.

With persistence taken care of, adding pictures to Excursional trips was next up on the to-do list.  After a bit of tinkering with Android’s camera Intent, I was able to allow the user to take a picture with Android’s native camera app and have that picture linked in to their Excursional trip.  Here’s a teaser:

Now I need to add the pictures to the trip’s xml file, and get some sort of photo gallery up.  Overall, things are looking really good now – only a few more bits of functionality to add before Excursional is ready to go!

– Allan