My first week of UROP: Developing for Android

I'm currently on an Undergraduate Research Opportunities Program (UROP) placement, working with one of the academics in my department to develop a set of mobile applications (apps) to support his lecturers.

A little background info

In my first year of university, I studied a module called "Cybernetics and Circuits" and one of the aspects taught in this module is about block models for feedback system.

The lecturer, Dr. Richard Mitchell, provided a set of Windows applications that demonstrated various systems in a dynamic way that allows the user to see the effect of input and disturbances on the output. Unfortunately for me, all of my personal computers I take to Reading run Mac OS X and not Windows. This meant that if I wanted to view these demos I had to use a computer on campus. This wouldn't do. So over the next two terms, I taught myself to program in Objective-C by developing an app for the iPhone. Over the summer, I extended this further by making an extended interface for the iPad and by the end of it had ported two of the windows demos to an app for iOS that is now available in the app store (link).

Dr. Mitchell set up a research placement for me, with the goal of further developing the application, so that it can be used along with his lecture material as a learning aid.

During my research placement, my first task is to port the already existing iOS app to Android, so that it can reach a larger user base. In order to do this, I've been learning to develop for Android.

My Android development experience so far

To start, I downloaded the Android Developer Tool (ADT) from the developer site. This bundle has the developer preview of the new Android version, L, which has just been announced. However, the release also has a large number of bugs, meaning creating a new project did not work as expected.

In order to get developing, I googled around and downloaded an older version of the ADT (version 22.6.2) and have been using that successfully since.

I've learnt that Android does not follow the Model, View, Controller (MVC) pattern I'm used to using when developing for iOS. This is to keep from limiting developers, but I like the MVC pattern, so I'm using it anyway.

Responding to User Interface (UI) elements with any method other than onClick has to be done programmatically rather than through the graphical interface/XML file that defines it (if I'm wrong about this and you know, please drop a comment below!) - This has created its own set of issues I've had to overcome.

So far, in general, things are going well. There have been hiccups, sometimes due to the quirks of Android development, other times due to my own failures of logic, but I've yet to have an issue I've not solved and the application already has the same functionality as the iPhone version - just not fully there with the UI yet.

A tablet/phablet interface that mimics the iPad interface and functionality is planned. However, the core goals of this placement are related to the functionality of the app, so that will be the main focus. Niceties such as tablet/phablet optimised interfaces will be addressed at a later date - most probably as a side project of mine.

So, how do the IDEs compare between Xcode and Eclipse?

There are a lot of features of Xcode that I miss when using Eclipse, for example, its amazingly powerful auto-complete. Also, I find that Eclipse is buggy and at times crashes, or requires a clean of the project because for some reason it's interpreted some code incorrectly and is throwing up an error that simply does not exist in the code.

But more surprisingly there are some features of the Eclipse Integrated Development Environment (IDE) that I wish Xcode could share. The UI screen preview in the Eclipse IDE is great. Custom views are parsed and you see what you will see on the screen, even when implementing your own onDraw function. In Xcode, custom draw methods for views are not interpreted and to see how a custom view will look, it must be run on a device or emulator. However, Android development uses Dalvik, which utilises a just-in-time compile method, which is easy for the IDE on the computer to emulate to draw the views. iOS uses Objective-C, which requires compiling.

Talking about emulation, the emulator for Android is just painful. So painful, in fact, that most of the time I'm using a Samsung Galaxy S2 and a Moto XOOM instead whilst developing and testing. Unfortunately, as Android devices are not all uniform like Apple devices, testing on just these two devices is not enough. To test different screen sizes and pixel densities, the emulator is required.

So what's next?

Over the next 5 weeks I shall be working on both the iOS and Android version of this application. I will be working closely with Dr. Mitchell to make the application as useful for teaching as possible, whilst still working within the limitations of the devices.

I shall try to post a weekly update to my blog, so if you're interested, keep an eye out for the next update!

Comments