Image for post
Image for post

Some time ago I was looking at some Kotlin code with Coroutines and one line of code attracts my attention:

val job = Job()

But wait, thought I, isn’t Jab an interface? And indeed, it is an interface ! Okay, thought I, do I missed something and there is a way to create an instance of an interface in Kotlin? The answer is — no, Kotlin doesn’t allow to do that. But how it is possible to write code like that? And the answer is — Pseudo constructor.

How it works

Let’s look step by step how we can implement a pseudo constructor. …

Working with Kotlin I found that “return” from lambdas is not always obvious and sometimes may lead to the issues. So let’s try to demystify “returns” with the examples.

First, let’s consider a function that receives a lambda as a parameter and call it inside(BTW this function in Kotlin is called High-Order function — HOF):

fun testWithAction(action:() -> Int) {
println("start test")
val result = action()
println("end test with $result")

Because testWithAction is a HOF, We can write lambda outside the parentheses and also We can omit the parentheses because they are empty. …

Since Android API 19 Google provides a great feature — Transitions Framework. There are a lot of articles and videos about this framework, which describe why we need it, how to use it and so on. But today I want to talk about the custom transitions: why do we need it, how to implement it and some pitfalls I faced when was implementing my own custom transitions.

Why do we need the custom transitions?

Android SDK provides a set of the built-in transitions that developers can use in their apps(like ChangeBounds, Fade and so on). …


Roman Bielokon

Android developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store