The Android guy

First experience with Jetpack Compose

onCreate It’s been a couple of weeks since Jetpack Compose reached in alpha state. So, I thought I should start giving it a try. Getting started with it is not that hard. There are a lot of options, but I will render what worked for me: Joe Birch’s blog. Stack Overflow A quick read through the Google Codelabs Jetpack sample apps from Google’s repository (Mostly looking at JetNews) Note This posts code example is not a best practice example.

The Great Wall of China was originally created to keep WebView out. It failed miserably.

onCreate Let’s face it, getting a NaN in Android is more frustrating than a (Kotlin)NullPointerException. Well, as a Native Android developer, I actually never touched the web professionally, except playing around with Vue js when people seemed pretty hyped for it. I tried to be a web developer only once in my life, but even then, I cheated, I used KotlinJS. Anyways, many mobile developers have been in situations when they had to write a WebViewFragment and load an URL.

First look on Hilt

onCreate A new Dependency Injection library called Hilt was presented from the Google team. It was designed on top of Dagger library and provides a simpler, less boilerplate API to handle dependencies in an Android application. As first try, it was a real game changer. Therefore, we will make a short introduction to it, and then discuss about some opinions. Why was it build? First of all, Dagger was a little hard to start with, especially for beginners.

Realm 7, the frozen throne

onCreate As many of us might know, Realm has already introduced freezing objects. Personally, I have been waiting for long time for such feature. So, what actual problem does this solve? A lot of us might have faced this issue: Realm access from incorrect thread. Realm objects can only be accessed on the thread they were created. I believe the error speaks for itself. Realm < 7.0: When you call Realm.

Why LiveData is the best solution (yet) for UI

Why LiveData is the best solution (yet) for UI As far as I am concerned, there are many developers who don’t like LiveData. However, for the UI part, there is no better API to achieve MVVM (or even MVI,or stateful MVVM). Furthermore, makes the UI control very easy. There might have been some small misconceptions regarding the usage of it, but, if you use LiveData for the purpose it was created, I think that’s far better than any other API (for the moment).

Coroutines and callbacks

Callbacks in Java are probably the most basic way to perform executions/send actions between classes. If you have chosen to use coroutines in a project, you want to keep the same style everywhere. But what if some of the libraries you use, are still using callbacks? No worries, Kotlin coroutines are easily integrated with callbacks. It’s just a small workaround to make. Let’s think of a very simple use case: