Google+ Badge

Wednesday, February 23, 2011

Second iPhone provisioned and optimized Android code

It looks like all the adjustments I made in Xcode to the project file paid off. I was able to easily provision another phone today for our Business Analyst. I did the update to the provisioning profile in Organizer, plugged in her phone and did a Run. The application copied over right away. She can now do screen shots for promotional material for both the iPhone via her own device and for the Android using the emulator.

On the Android side of things I noticed it was taking a long time to deal with some server data. I finally had the chance to check that out today. I put in a new timing object and looked to see where the hold ups happened to be. It was not in the server call itself, the XML data came back in under a second, but it was in the XML parsing. We are using the XML Pull Parser that comes with the Android SDK. Listed as just a little slower than SAX and much faster than DOM.

I figured out how to do profiling via traceview and found the slowness to be in our start tag processing code. I looked over that code and eliminated an unneeded StringBuffer, over creation of an ArrayList object, some string comparison clean up, removal of instance of check and some if statement cleanup. I was able to cut the parsing time from ~20 seconds to ~6.5 seconds in the emulator. It runs in ~2.2 seconds on my Galaxy S phone. I still want it faster but this is a huge and very noticeable speed improvement. I need to run similar timings on the iOS side of things. My iTouch is out in QA land so I can only test in the simulator at this point which can be very misleading.

I need to take my optimizations and move them into the main branch of our desktop Java code. Speed improvements always help - well as long as they don't break something. Fast and broken is still broken.

At this point I have the two mobile apps running pretty smoothly and graphically pretty close to the same where it should be and different in places where it does not need to be. I did more tweaking on the lower DPI screen in the emulator for the Android to get the look we need. I adjusted some HTML code on the iOS side to give a better layout look. Very happy with the results. They can start using screen shots for the glossy promotional stuff any time.