Getting Xcode static libraries to work
Getting Xcode static library dependencies to work is way harder than it should be! This weekend I setup a new Xcode OS X workspace with 2 child projects. One project was the app and the other a static library used by the app. Setting the static library as a dependency of the app project took ages. Part of the reason was my lack of knowledge but Xcode should really give a bit more help.
Anyway, for the good of the people here are 2 blog posts I found helpful. I was using Xcode 4.6.
http://blog.stevex.net/2012/04/static-libraries-in-xcode – I found this the most useful for setting up the dependency, however steps 10 to 16 weren’t needed for Xcode 4.6. Probably because Apple fixed a bug.
http://blog.carbonfive.com/2011/04/04/using-open-source-static-libraries-in-xcode-4 – The instructions for setting up a dependency didn’t quite work for some reason. However, the section on creating a static library is useful.
Using AndroVM
AndroVM is a novel alternative to the Android emulator with Android running in a virtual machine (VM) using VirtualBox. It works quite well and for some requirements can be significantly faster than the Android emulator.
Installing and setting up is as simple as installing VirtualBox and importing the Android VirtualBox images available here.
To debug and install your apps using adb:
- Get the IP address of the VM from the AndroVM Config app running in the VM. If the app doesn’t show an IP address make sure you’ve created a host only network in the VirtualBox preferences and configured the VM to use that host only adapter as “Adapter 1″.
- Execute ‘adb connect <IP address>’
- From this point the standard adb commands (such as ‘adb install’) should work.
AndroVM is still in it’s infancy and as such does have a few bigger limitations:
- Only Android 4.1 images are available.
- The available screen resolutions are limited but can be easily selected using the AndroVM Config app running in the VM.
On the plus side, the team behind AndroVM have promised configuration management software to make it easier to create and run different Android configurations. Additionally the software will also automatically connect adb with the VM.
UIButton in UITableViewCell has no highlight state
I recently created a custom UITableViewCell with a UIButton as a subview. Pretty standard except that the highlight state of the button was only activated if you held your finger on the button for more than some fraction of a second. The solution is quite straight forward but is subtle enough to justify a quick blog post. Read more 
Custom drawable states in Android
A state list drawable is a really useful Android resource for displaying different drawables for a view depending on the state of that view. e.g. we can define a state list drawable for the background of a button that defines a colour for both pressed and unpressed states. The button takes care of switching between the two drawables depending on the state, saving us the effort.
You can make state list drawables even more useful by defining custom states. Read more 
Tiny Stopwatch for Android
Today I released my first personal Android app into the Google Play Store. It is a stopwatch app that supports multiple stopwatches and is designed to work across phones and tablets. It is also built from the ground up to fit in with the new design paradigms used in the latest versions of Android such as the action bar. I also just wanted a better looking stopwatch app.
Check it out here: https://play.google.com/store/apps/details?id=com.tinystopwatch.android
Android screen utility class
There are a few common operations I infrequently perform related to the Android screen:
- Converting a pixels value to the corresponding density independent pixels (DIP) value and vice versa
- Getting the screen dimensions
- Checking what orientation the device is in
- Getting the screen size (small, normal, large, extra-large)
They’re not difficult but it is annoying having to remember exactly how they’re done so I created a utility class to make it a bit easier. Here it is: Read more 
Views saving instance state in Android
The activity lifecycle is central to Android development. Although it is quite well defined, it does take a bit of getting used to. One aspect new developers perhaps struggle with is that rotating the device will by default destroy and recreate the activity.
A well behaved activity will restore its state after a rotation so the user can continue using the application with no lose of state. e.g. EditText widgets should restore the text they contained when the device was rotated and a long running operation should resume without restarting.
There are a few topics to understand to achieve this effectively but one that I’d like to talk about is views saving and restoring their instance state. In most cases saving state is actually very simple but when creating compound views a couple extra steps are required. Compound views combine multiple views into a single convenient reusable view, e.g. the NumberPicker. Read more 
Android vs iOS development presentation
Last week my colleague, Nick Street, and I gave an ‘Android vs iOS Development’ presentation for Edinburgh Student Techmeetup on behalf of Kotikan. We only had about 25 minutes so didn’t go into too much depth. Was good fun and worth a watch just to find out who wins.
Android v iOS App Development from Kotikan on Vimeo.
Book review: Application Security for the Android Platform
Just finished reading ‘Application Security for the Android Platform: Processes, Permissions, and Other Safeguards’ by Jeff Six.
Disabling Android TextView suggestions
Android TextViews provide suggestions to the user as they type. Although the user can disable this feature in the system settings there are cases where the developer wants to always have suggestions disabled for certain TextViews. Read more 



