Server-driven UI is not a new concept. Neither for Android, iOS, or the web. It is quite popular in recent years, especially with the introduction of component-driven architectures such as Flux / Redux and others. Now three projects ahead with server-driven architecture in place, I want to share with you some of the challenges that we faced, and the different approaches to solving them. And I will be really happy if you share your experience too.
Continue reading “The challenges of server-driven UI on Android”Category: Android
Local KtLint configuration for Android
KtLint & Detekt are tools that help us keep our code formatted in the same way and sometimes even help us spot errors before they are actually merged to master or develop.
Most of the CI integrations already include a detekt step before the unit tests are run. To avoid waiting for the CI, you can easily integrate ktlint as part of Git hooks. So every time when you decide to commit, Git hooks run and ktlint analyzes the committed files and prevents you from pushing until you fix your errors.

RecyclerView loses focus when scrolling fast … or how to use it on Android TV
We had a project where we were aiming to reuse the same codebase across mobile and TV. You have this care very often and there is this consideration of:
Should we use the Leanback Fragments?
The experienced Android TV developer
that is always ignored. We give the project a quick go and check how it works on the Android TV emulator and decide it is not worth the effort to work on TV specific codebase that may require additional devs to support it. And this is where hell breaks loose.
Continue reading “RecyclerView loses focus when scrolling fast … or how to use it on Android TV”Taming websockets with Coroutines, Clean Architecture and a library
Websocket integration is one of the biggest issues I had in my whole experience with Android. Why is it such a huge pain? There are several reasons behind that:
- Connection should remain stable no matter what – and we know how complex the Android lifecycle can be.
- Sending data can be a one-way operation without giving any result – did you succeed in sending it or did you fail? Only Server knows.
- Retrying connection or network requests can be tricky to implement – from pushing logic to interactors to having an internal logic inside a repository, be sure – nothing will work at 100%. Not even at 90% either.
- To get it right you need both frontend and backend collaboration. Nothing can be done if both sides do it separated from each other.
Android navigation library and TransactionTooLargeException
Let’s admit – the Android navigation library is a really cool thing but it has its own issues and drawbacks. One of the issues you can have is the TransactionTooLargeException. And here is how it happens.
Continue reading “Android navigation library and TransactionTooLargeException”Don’t forget about the difference between android:windowActionBar vs windowActionBar in your theme
What is the difference between this piece of code:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
</style>
and this one:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowActionBar">false</item>
</style>
How to make DatePicker stretch when CalendarView does not fit the screen?
In Android we have to deal with both big screen and small screens, tablets, watches, TVs and many other devices. In our case, we had a device with a 3.2″ display and other one with 5″ display. And on both of them we show a DatePicker dialog to choose a date. And guess what? Especially for the current month of October, there was a small difference. Can you guess it in the screenshot below?

Approaches not to cause a crash when setting toolbar title on the activity through a fragment
Setting a toolbar title on the activity should be easy, right? But what about if you want do it through a fragment? Still easy? Well, not exactly.
The issue is that you may try to touch the toolbar in a moment where the activity is actually still not inflated. This will cause an exception immediately and your app will crash. What is the exact issue?
Continue reading “Approaches not to cause a crash when setting toolbar title on the activity through a fragment”Fix the display of the toolbar in Android Studio
From time to time I get this really nasty bug where the toolbar in Android Studio is aligned to the start of the screen.

I mean the part where you select the device and press Run, for some reason sometimes just moves to the left and bringing it back to the right is a bit of a pain. Also if you hide the main navigation toolbar by accident, then it is really hard to bring it back. Here is the solution:
- Close Android Studio.
- Go to Home/.config/Google/AndroidStudio2020.3/options
- Delete ui.Inf.xml
After that just start Android Studio as normal and all of the toolbars will be placed as they were by default.
Android Studio Arctic Fox not building a signed APK
Generating a signed build using Android Studio Arctic Fox version 2021.3.1 seem to be a tricky thing to do. I spent several hours just to figure out where the issue is and at the end, I still don’t know what is the exact reason for signing to not work.
Continue reading “Android Studio Arctic Fox not building a signed APK”