I’ve been working with the Access Storage Framework introduced with Android KitKat, a feature that I’ve been waiting for a long time. Everything seemed to be alright, quite easy to implement, until I faced a strange issue. Once the file has been selected by the user, I wanted to store the file’s URI and re-open that URI the next time applicati... Read more 09 Jan 2015 - 1 minute read
Life is too short: please, don’t waste your time writing code! I’m not saying that you don’t have to code, but many people tend to waste too much time typing on the keyboard instead of producing code. Mee too. Following examples relate to Android’s world, but that can be easily adapted to other languages and programming tasks. Aliases Android... Read more 16 Dec 2014 - 1 minute read
Starting from this blog post by Bryan Rosenbaum, here is a gradle task to auto increment versionCode inside your build.gradle file. import java.util.regex.Pattern ... task incrementVersionCode << { println(":incrementVersionCode - Incrementing Version Code...") def buildGradleFile = file("build.gradle") def patternVersionCod... Read more 04 Nov 2014 - less than 1 minute read
There are many ways to create a fragment in Android, but to create a fragment properly you need to follow specific guidelines. For example, it’s required that the class has a public zero-parameters constructor. If we need to pass parameters to the fragment, we need to use the method setArguments(). Try to pass some parameters to the constructo... Read more 08 Sep 2014 - less than 1 minute read
Here are two simple methods to write a boolean value into a Parcelable object and read a boolean from a Parcelabe. public static void writeBoolean(Parcel destination, boolean value) { if (destination != null) { destination.writeInt(value ? 0 : 1); } } public static boolean readBoolean(Parcel in) { if (in != null) { return in.rea... Read more 17 Jun 2014 - less than 1 minute read