Game Development with my Preschooler

My son is almost four and has had a lot of recent exposure to video games (for better or worse). He also knows that I’m a software engineer and that I’ve done some game development before he existed. As a result, coming up with game ideas is one of his favorite topics when I’m putting him to bed at night and he has narrowed in on his dream game in the past week or so. [Read More]

Introducing: patb.io

Welp, I finally bought a short vanity domain and need to populate it with something, so here it is in all of it’s uncompleted glory. I’ll back fill this with posts from my old blog as well as new stuff as it comes to me.

BundleButler: Simplifying arguments and savedInstanceState

To make proper use of both Fragment arguments and saved instance state in Android, I found myself frequently writing a great deal of the same boilerplate code. Most of that code looked like this: public class EditEntryFragment extends Fragment { private Entry entry; private String title; private boolean hasAgreedToTerms = false; public static EditEntryFragment createInstance(Entry currentEntry, String title) { EditEntryFragment fragment = new EntryEditFragment(); Bundle args = new Bundle(); args.putParcelable("entry", currentEntry); args. [Read More]

Amazon Fresh Bookmarklet

I recently started my trial month of Amazon Fresh and was a bit disappointed in the lack of integration the service has with Amazon.com. Specifically, there doesn’t appear to be a way to add to your Fresh cart from Amazon.com. I understand the need for different carts, but don’t understand why I can’t send to Fresh or transfer between the two. So I’ve created a quick and dirty bookmarklet that will open an Amazon ASIN in Fresh for quick addition to your cart. [Read More]

Indispensable Android Libraries

With recent surge in adoption of the new Gradle-based Android build system, it’s easier than ever to incorporate Android library projects (and libraries in general) into your project. Gone are the days of complex pom files, submodules, forked repos, a huge libs folder or worst of all, copying code as-is into your repo (you never did that, right?). Now a full Android library or utility can be included with a one-line addition to your build. [Read More]

Improving RoboGuice Application Start Times

RoboGuice is a fantastic dependency injection framework for Android that wraps Google’s Guice DI library with a set of helper classes and default injections that can make an Android developer’s life much easier. Unfortunately, this comes at a cost. Guice was not designed with mobile devices in mind and instead targets servers where objects startup is long but once you’re up, responses need to be quick. Because of this, startup times for apps using RoboGuice can be noticably long in the best case and uncomfortably long if you’re not careful. [Read More]

DI on Android Without the Startup Cost: dagger

Anyone who has used a dependency injection (DI) framework on a project can likely speak to its benefits when creating complex systems. Relying on it can help an engineer to design and implement clean, testable software. Anyone who has tried to write Android applications using a DI framework has likely been disappointed in some degree with current offerings. DI frameworks in Java have largely been written with server architectures in mind and as such are either generally too resource heavy to work on a mobile device. [Read More]

Gson & Deserialization of Objects Containing Arrays

After my practicum team and I banged our collective heads against the wall for several hours trying to force Gson to deserialize json arrays into a collection of complex classes containing their own collections, we chose to go another route entirely. Our problem at the time was that we had blinders on and couldn’t walk away from using Javas Collections library. I came to realize today that Gson does a fantastic job of deseralizing classes with any depth of arrays so long as those json arrays are actually represented as primitive arrays in your java class. [Read More]