Sharing the Code

Programming stuff that might be useful to others

Tag: Android

Threads and handlers in Android

On iOS you can get away with not being too concerned about the responsiveness of the UI when doing things like saving to the database but on Android the slugishness is noticeable. This is the scenaro – the user taps on a UI control which starts an operation that takes a small but noticeable time to complete – you are basically trying to avoid a non-responsive UI. If the operation is fairly short you can get away with using a Handler. This allows you access to the main UI thread’s message queue. If the operation is a bit longer, say a second or more you would want to use a thread.

Read more

Comparing iOS and Android Development

Having created an Android version of my iPhone app Grocery Cook I thought I would share some thoughts on the differences between the two platforms. To boil it down, Android’s language of choice, Java is better than iOS’s Objective-C, but iOS has a more comprehensive API. Having full desktop Java on a mobile device is quite nice but you tend to have to create more code to make up for the holes in the API.

Read more

Android – backward compatibility

As a web developer I’m used to getting stuff to work on a number of different browsers. With the web and mobile phones, software has become available to a far wider audience so I think one should take advantage of that strength. With both the iPhone and Android version of my mobile app I targeted the current OS version but implemented it so it would degrade gracefully for previous versions of the OS. In the Android version I set the minimum Android version to 1.6 because that is the minimum requirement for in-app purchases.

Read more

Adding Android’s source to Eclipse

Sometimes it would be nice to click on an Android class and be able to see the source in Eclipse. You could download the source using Git but you then have to rearrange the Java files. The following is the most straight forward way I have found.

Read more