Sign in

Android’s <activity-alias> tag is one of the most unused tags in the android manifest. The existence and benefits of it are unknown to many Android developers, even today.

Activity alias represents a symlink to an Activity. The most popular use of activity alias is to prevent the removal of the app launcher shortcut when the underlying launcher activity is changed.

💡 Activity alias has been residing inside the androiManifest.xml since API 1.

Image for post
Image for post

The Curious Case of the missing shortcut

When a launcher icon shortcut is created, it is statically linked to the exact activity of the Launcher. …

Kotlin coding conventions denotes that we should prefer if for binary and when for three or more options.

  1. Why?
  2. Why is when preferred for three or more options?
  3. Why IntelliJ IDEA/Android studio warns us with “Cascade if should be replaced with when”?
If-else hell
If-else hell

Understanding Kotlin and Java if-else

  • Let’s take an example of a cascading if.
  • Let’s check the decompiled byte code.
  • Let’s understand why when is preferred.
  • Let’s solve a puzzle together.

Cascading If

Fuel is not an alternative for Retrofit because both the libraries offer a different experience for developers. Retrofit is currently the market standard so let us look into Fuel.

Android Network profiler
Android Network profiler

What is Fuel ? ⛽

  • The easiest HTTP networking library for Kotlin/Android by Kittinun Vantasin
  • Offers maven and jitpack installation
  • Has a wide range of extension modules for every possible tool
  • Uses httpUrlConnection (No Okhttp support; yet)
  • Kotlin- first library

Is Fuel a 🆕 Library in the market ?

I had a quick look at the release tags in Github and the first tag 0.6 was dated 11 Aug 2015. Its been around for quite some time now. …

Image for post
Image for post

Kotlin Interface supports default implementation. Which implies that we can have a default implementation to all the properties and functions defined in the Interface.

The debate:
Having default implementation on interface is not appreciated by many developers. We are not going to discuss about the pros and cons, but we are more interested in how Kotlin has achieved this.

Note: To keep things simple, the java code blocks used in this article is the decompiled java equivalent of the generated byte-code by the Kotlin compiler.

Let’s get started

Lets take a basic interface Wheels with default implementations as an example to understand the…

As the name states, a data class is a class that holds data. The difference from the normal class is the auto-generation of some standard functionality and utility functions derived from the data itself.

Image for post
Image for post

Have you asked anyone this question ? “What’s the difference between a normal class and a data class ?”….

Usually their reply would be:

  • Data class holds data
  • Auto-generates getters and setters
  • Overrides hashcode(), equals() and toString() methods

Little do they understand that there are few more functionalities generated along with the usually known functions.

  1. copy()
  2. componentN()
  3. copy$default — A synthetic method

1) Copy()

The copy() function is…

Cold folding is a good practise while working on complex code. It helps us to be focus on the task ahead and not get distracted by unnecessary information. It also helps in organising code or hiding less useful information so one can focus on more important information.

In this blog we will focus on Regions, a small topic in code folding.

Defining custom Region block

The syntax to create a custom regions starts with a comment followed by the keywordregion and end block with the comment endregion. This can be very helpful in grouping of code and also for documentation.

Syntax: Java/Kt file

//region $NameOrDescriptionOfRegion

The ability to work on multiple projects with different team members have always been the strong suite of people at Modulotech. Over the years we have been successful in sharing our knowledge with everyone and every project, as we have multiple contributors working towards the same goal. The journey towards this goal is not yet achieved, as the journey never ends.

Here, I would explain a small change in our big journey, our transformation from an unformatted git message to a better solution.

Image for post
Image for post

Every change is treated as a magic trick. We are the magicians and the audience.

Every magic…

Image for post
Image for post

It is one thing to come up with intuitive naming for String keys but its totally another to manage and organise your colors in an Android project.

The Problem :

Your colors.xml will initially have the primary, primaryDark and accent by default, based on your theme pallette.

Later you would add few colors with their proper name.
ex: white, black, red etc,.

But before you could realise, you would have started adding the location of the color, as the key, rather than the color itself.
ex: login_bg_color

Image for post
Image for post

Never .gitignore a .gitignore

It’s a good practise to follow a common .gitignore for all your Android projects.

# Built application files
# Files for the ART/Dalvik VM
# Java class files
# Generated files
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/
# Gradle files
# Local configuration file (sdk path, etc)
# Proguard folder generated by Eclipse
# Log Files
# Android Studio Navigation editor temp files


Tech Lead Android, Modulotech

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