20 Things, Week 16

I had my first open-source pull request merged this week, into Dogr.io.

Read on →

20 Things, Week 15

I checked in some code every day this week. That being said, I don’t really have a ‘Thing’ that I’ve done. Turns out that I’m running out of ideas for small, week-long projects. My plan to do some small things and even a bigger project over my 2 week break didn’t work out so well - Christmas takes up a lot of time, and there was plenty of other things to do in my time off, too.

So while I haven’t done any one thing worthy of note, some of the stuff I have done (these are mostly quite trivial):

  • Implemented PullToRefresh library
  • Implemented the Crouton library for toasts
  • Decided that loading 1000+ items with ORMLite to back a ListView was not a good idea and actually got around to writing the plumbing code to use a Cursor
  • Added a check for ‘last checked date’ so we now query for the smallest number of quakes

20 Things, Weeks 13 and 14

You may have noticed (heh, who am I kidding - no one is sitting around waiting for these captivating posts) that I missed week 13 of my 20 Things, 20 Weeks project. I could make excuses about it being Christmas, and being super busy, but that’d be a lie. I was probably playing Hearthstone.

Read on →

20 Things Week 12

Actually managed to get some code written this week, though it’s still pretty rough - I’ve got a basic widget working for What’s Shaking, NZ? for Android. Exciting stuff; that’ll be polished up and good to go next week. It was actually really easy to do, as I can update it directly from my existing background service (which polls the NZ Geonet API).

Also wrote a blog post on a common Java encoding issue - basically, when you’ve got a UTF-8 file with a Byte Order Mark at the start, things that parse that can freak out if they’re not expecting it. Easiest way to avoid it is to get rid of the BOM altogether.

Broken JSONObject creation from a UTF-8 input String

12-16 12:01:40.446: W/System.err(3873): org.json.JSONException: Value  of type java.lang.String cannot be converted to JSONObject

Faced this issue, again, at work today. We have a build system with build variants for different customers. To add a new customer, we just create a new folder, add the images and add a JSON config file to suit the new customers settings. We read from that file and into a JSON string (and then into a JSON object) something like this:

InputStream inStream = context.getResources().openRawResource(R.raw.local_config);
String json = IOUtils.toString(inStream);
JSONObject jsonObject = new JSONObject(json);

Sometimes, new customers speak a language other than English, and we have to save non-ASCII characters. In this case, the file gets saved as UTF-8. Testing this isn’t a problem on my devices (Galaxy S2/Nexus 7) - but my tester has twice come back to me now and said that it doesn’t work on our 2.3 device.

Read on →

20 Things, Week 11

Once again, nothing to present this week. I’ve continued looking into this bug in KitKat that I mentioned last week; I’ve spent most of my time trying to replicate it in a minimal amount of code. This included exploring the OkHttp tests (which was… an interesting exercise), and modifying the sample code provided for the original bug whose fix I suspect introduced this problem.

Despite all this, I’ve still been unable to reproduce it except via a Twitter stream (which requires a bit more setup than a chunked encoding HTTP connection without encoding - and so I’ve been avoiding this in the minimal time I’ve had to try this).

Additionally, I lost a bit of motivation part way through the week with news that 4.4.1 is just around the corner - if the bug is fixed in that release, I won’t bother working on it anymore! Unfortunately, as of this writing, there’s still no Nexus 7 2012 image available.

20 Things, Week 10

So, the halfway point of my wee experiment. 10 weeks out of 20. The most obvious question at this stage is have I created 10 Things? Nope, but that’s okay.

Read on →

20 Things, Week 9

So this week, like most of the Things I’ve done for this project, I wrote a blog post. Shocking.

This post was a fairly hefty one, covering the new Volley library for Android. If you’re performing any network activity in an Android app, I’d recommend taking a look at it. It helps to avoid a whole skew of problems you may not even know exist, and has a lot of useful features. It takes a bit of reading to get set up, but once you know what you’re doing it’s great.

Getting started with Volley for Android

Volley is a new Android networking library from Google (well, by ‘new’ I mean from May, at I/O 2013 - so some 7 months ago). It has some cool features - request queueing with priorities, automatic selection of the best HTTP library depending on Android version, and a nifty view for automatically loading images. Unfortunately, even 7 months on, there’s pretty minimal documentation available. However across StackOverflow, a bunch of blogs and the source code, there’s plenty to go on to figure out how to do some basic tasks.

Read on →

20 Things, Week 8

We had a crazy week at work this week; we’re doing a rewrite of our app, and we had an internal stakeholder demo. Was doing some long hours.

This weekend I went to devmob in Dunedin. It’s an unconference/barcamp that’s held here for mobile devs from all around the country. Met lots of interesting people and had a great time - but there was no time to write code.

So, this week, I’ve done nothing towards my 20 Things. Unfortunate, but I knew this would happen. Next week I’ll definitely have something out!