Pluralization in Android

If you are writing an app, that uses a string containing numbers, for example: Deleted 1 message Deleted 2 messages You could manually create two different strings, and show either one by using an if/else, depending on the number variable. However, as you start internationalizing your app, by adding more translations, this quickly gets out of hand! Using Plurals Luckily, theres a great solution for this. In Android, you can use something called "plurals". You can use plurals in

» Read more

Butterknife - A viewbinding tool for Android

Are you tired of writing findViewById(R.id.view) everywhere in your app where you are dealing with views? There is a tool by Jake Wharton at Square, called Butterknife that uses annotation processing to generate this boilerplate code for you. It can do field and method binding for your views, which can save you a lot of typing, and make your code a tad cleaner. Installation This is the easiest part ever. Add Butterknife to your app with Gradle.

» Read more

Sideloading Android OTA updates

If you have a Nexus device, it will regularly get updated to the newest Android version. If you don't like to wait for the OTA update to arrive to your device, you can sideload the update if you can get your hands on it. Note: You should always backup important files on your device before doing an update like this. Use this at your own risk, should anything unexpected happen to your device. Downloading the OTA update file Usually, Android

» Read more

Useful ADB Commands

If you are developing Android apps, using the Android Debug Bridge tool (ADB) may sometimes be necessary, or could save you a lot of time. With ADB you can install/uninstall apps, forward ports, push/pull files to your device, remotely connect to SQLite databases on your device, record the device screen, and more. See the link at the bottom for a full reference. Setting up the ADB tool The ADB tool comes with the Android SDK, and you can

» Read more

Easily add device frames to your Android app screenshots

If you have an app that you want to showcase by taking screenshots, you can easily make it look more appealing by adding the correct device frame around the screenshot. Fortunately, this is easy to do. Method 1: Using the Android developer website On the Android developer website there is a page where you can drag and drop your screenshots onto one of the 5 Google devices, to automatically generate a screeshot with a frame, that you can just download.

» Read more

Fixing a nasty RuntimeException in Android Preferences

You may come across this exception if you are using PreferenceActivity/PreferenceFragment, and have been messing around with custom list separator styles. The exception looks like this: 05-03 15:35:10.013 7029-7029/com.app.package.name W/dalvikvm´╣Ľ threadid=1: thread exiting with uncaught exception (group=0xb0cb3b20) 05-03 15:35:10.023 7029-7029/com.app.package.name E/AndroidRuntime´╣Ľ FATAL EXCEPTION: main Process: com.app.package.name, PID: 7029 java.lang.RuntimeException: Binary XML file line #18: You must

» Read more

Get started with Docker on OS X

Docker is an amazing platform which can help you setup different environments to run or test your applications, or just quickly get started with some software. It is a container virtualization technology that runs your application in very lightweight containers, similar to regular virtual machines. However, it is much more efficient in terms of resources needed to run applications. In fact, this website is running inside a Docker container. Because the Docker daemon uses Linux-specific kernel features, you can't run

» Read more

Apple bluetooth keyboard disconnects, and won't reconnect

A few times now, lucky me, have experienced that the bluetooth Apple keyboard is disconnected, and not working. It has happened after putting my MBPr 15 into sleep, and when waking it up, the keyboard will not automatically reconnect, as it should. Also, to top it off, the bluetooth settings in OS X seems to have frozen, as it does not respond anymore. You simply cannot turn off bluetooth, to try and reconnect the keyboard! The first thing I tried,

» Read more

Connecting your Android device to an OpenVPN server

This is a follow up post from the previous one, which walked through setting up an OpenVPN server on your own Amazon EC2 machine (for free!). So, assuming you already have the server setup, lets continue by connecting an Android device to the OpenVPN server. Create a new user Navigate to the admin page of your OpenVPN server: https://<machine_ip_adress>/admin/ (Your browser may warn you about the https certificate safety issue, since we have not

» Read more

Syntax highlighting in your Ghost blog with Prism.js

To make code and markup such as XML and HTML easier to read on a website, you should use syntax highlighting. Ghost does not have built in syntax highlighting out of the box, but its quite easy to add it! Theres a library called Prism.js (by Leah Verou) that can add such a feature to your website. Setting up Prism Go to the prism download page, and select a theme, and which languages you would like highlight support for.

» Read more