-

·
Choosing Wisely: for vs. forEach in Kotlin (A Thinking Dev’s Perspective)
The forEach loop, are you using it without thinking? In Kotlin, empirically forEach is often the go-to loop, it’s pragmatically close at reach in the IDE auto-complete, but is it always the right choice? This post argues that for loops deserve more consideration, offering clarity and control that forEach sometimes lacks. Let’s discuss why a…
-

·
build.gradle.kts conversion for Android Studio Empty Activity
Quick blog posting showing you the build.gradle.kts version of the default build.gradle file from the “empty activity” Android Studio template. This post will go stale fast, get it whilst its hot. 🙂 The original templates come from the New Project, other templates are explained here: https://developer.android.com/studio/projects/templates Google has an explainer of converting build configuration scripts…
-

·
When is a Type not a Type? Kotlin in the IDE
This article explains the ‘show type hints’ feature of IntelliJ. To get to see those sweet variable types you desire but not change any of the code conventions in your place of work.
-
·
Hiding Text in Kotlin – How many ways?
At some point you may want to show that you know a text value, but not show the value itself. For example, when you have sensitive data stored like a password, you may want to show a representation of the length of that password but not the characters themselves. How would you do this in…
-

·
Kotlin Anti-Patterns – Also this is Null
Kotlin is a young language, and with that comes many untrodden paths and unknown gotchas. Let’s explore one of these anti-patterns, for the sake of the article I’ve called it “Also this is null”.
-
·
[TUT] Speech to Text from a File with Google Cloud Speech API
This blog will explain how to use Google Cloud’s Speech API to convert an audio recording of someone speaking to text in Android. We’ll use Kotlin and the Google Speech client for best results. Google offers a speech recognition API, that is able to convert your spoken language into a textual representation. The API has…
-
·
[TUT] Kotlin Extension Functions by Example
Kotlin Extension functions allow you to add behaviour (think methods/functions) to any other type on the platform or in your codebase. The idea being to allow for greater flexibility and less boiler plate code. Let’s have a quick run through of how to create them and what are some advantages and disadvantages. The official docs:…
-
·
[TUT] Creating a ByteString in Android
The protobuf library has a construct called ByteString. This is a immutable sequence of bytes, usually used to serialise a file or other piece of data. Recently when using the Google Cloud Speech to Text library I had to convert a local voice recording to this protobuf ByteString to be able to send it to…