20 Things, Week 7

Not much in the way of code this week; work’s been a bit hectic, and I had a wedding to attend on Saturday. I did write a post on avoiding an OutOfMemoryError on older Android devices when displaying large bitmaps.

Speaking of that wedding, it was the one I was going to make a website for - guess that won’t be happening, then… oops.

Handling OutOfMemoryError with large bitmaps on older Android devices

If you’ve ever worked with bitmaps on an Android device before, you’ve likely encountered the dreaded OutOfMemoryError ‘bitmap size exceeds VM budget’. This issue can present itself immediately when testing, however on older devices it may not manifest except in certain cases. The reason for this is as follows:

In addition, prior to Android 3.0 (API Level 11), the backing data of a bitmap was stored in native memory which is not released in a predictable manner, potentially causing an application to briefly exceed its memory limits and crash.

Depending on what you’re doing, there is a way to get around this.

Read on →

20 Things, Week 6

In case you missed it, the Android Daydream I linked to in last weeks post didn’t actually go up until Wednesday - and the blog post (though dated Monday October 28, when I wrote it) didn’t go up until Tuesday. It was quite late on Monday, and the OS X Mavericks update meant my usual site deployment procedure (rake generate, rake deploy) didn’t work. I had to run rake as sudo for some reason (suspect it was something to do with Ruby in the new OS X?), which changed read permissions on everything, then when I tried to deploy, I had to do it as sudo again, and my Github SSH key is for my user, so that didn’t work. I gave up for the evening and went to bed. I managed to revert everything on Tuesday night, and I’m back to my regular deployment process.

Read on →

20 Things, Week 5

This week I wrote Dream in Tweets, which is an Android Daydream that shows the logged in users Twitter feed. A Daydream is effectively a screen saver that runs on Android 4.2 and up. But unlike a screensaver, it can do everything you can do in a regular Activity.

I used a bit of what I had already written for Feather to create this, but I’ve spent most of today working on things like respecting the Twitter Display Requirements. I’ll be able to reuse almost everything in Feather.

Read on →

20 Things, Week 4

This week I’ve done a fair bit of work. I just finished a blog post on Currency localisation which I’ve had on the back burner for some time - now I remember why, even writing that post gave me a headache. Currency formatting is a giant mess, as the formatting tables for most locales are pretty incomplete.

I’ve also made some significant progress on Feather (my Twitter app). It now loads a timeline feed and a mentions feed, and saves & loads those to a local database so that they’re pre-populated with the most recent data received when you first load the app. It can also post a new tweet (just a very basic EditText in a dialog at the moment), as well as Favourite/Unfavourite and Retweet tweets.

The next step with Feather is to build a proper New Tweet dialog fragment, so it can handle Replys/New Tweets/quotes/share intents. Onwards!

Android Currency Localisation Hell

We had a customer at work recently who had a special requirement around multiple currency support in our Android app. They have cinema sites in multiple countries, and they want customers to see the correct currency symbol when viewing sessions for a site. Up until now, the app has only ever had to deal with single currencies on a per-customer (and hence per-build) basis.

While implementing this multiple currency support, I came across something of a problem - the Android Currency code doesn’t behave quite as you’d hope, and is inconsistent across versions. Sometimes you get a currency symbol where you’re supposed to, sometimes you don’t - and sometimes the symbol is a slightly different symbol in one locale to that which is in another (¥, I’m looking at you). I’ve now got a set of test cases which do a fair job of explaining the issue, as well as the solution we came up with which mostly works.

Read on →

20 Things, Week 3

This week I posted up a Gist showing how to parse WCF-serialised JSON DateTime objects in Java. I’d done this at work a while ago and saw yet another question on StackOverflow asking how to do it. A quick Google showed there still wasn’t any quality examples of how to do it (there were a bunch of ways to do it, but none considered all cases), so I posted that example up.

Additionally, I started on my Twitter app - so far, it loads a timeline and can post tweets. Progress! The nice thing is a lot of what I’m doing at work at the moment can translate well to this. I’d like to have a properly usable client by next week, but we’ll see how that goes - I’m sure there’s a lot I haven’t considered.

20 Things, Week 2

Week 2 has not gone so well. I’ve managed to produce what I wanted (a MultiColumnListView control for Android), but I encountered more problems than I expected. Really, I should’ve expected that. It’s software development we’re talking about here, after all.

Read on →

20 Things, Week 1

Week 1 of my 20 Things in 20 Weeks project has gone well. I’ve finished one project and made some significant progress on another. I’ve managed to work on things 4 out of 7 days this week, even if only for an hour or two. I’ve found I’ve managed to get quite a bit done every time I sit down to work for a short period; problems are easily solved when approached with a fresh mind.

Read on →

Android Open Source licenses page

Ever used an open source library in your Android app? If you have, then you probably should have included a page with the license details for that library. If you did, great! You probably had the same question I did recently; how should you do that?

Read on →