Pitfalls of building a brilliant app

Hand holding phone
Hand holding phone
Photo by Masakaze Kawakami on Unsplash.

1. Things Should Be Where They’re Supposed to Be (Strings, Colors)

There is tremendous growth in the Android ecosystem around the globe with a diverse community. People from different backgrounds, people with disabilities, people who wish to have fancy features like night mode, and more use Android apps in their day-to-day life.

Developing apps for such a diverse community is not an easy task. I’m not speaking about high-level architectures here. In contrast, it’s about simple things like strings, colors, dimens, etc. that will considerably affect modern Android development.

People usually feel comfortable using an application in their native language. The vital step is to maintain all the strings in a…


Multiple view types in RecyclerViews using sealed classes

Phone placed vertically
Phone placed vertically
Photo by Stephen Frank on Unsplash.

One of the best ways to display huge lists in Android is through RecyclerView. As developers, you all might have used it. We have many advanced features like view holder patterns, rich animation, Diff-Utils callback to improve performance, etc. Apps like WhatsApp and Gmail use RecyclerView to show endless conversations.

One of the significant RecyclerView features that I use is view types. We can display multiple view types in the same RecyclerView. …


Using runCatching and Result from Kotlin Standard Library

Photo by Pejvak Samadani on Unsplash

Introduction

Before going into the actual concepts, first let’s understand the problem that we’re going to solve. State management is one of the critical aspects of any platform while the product is growing.

One of my apps in the Google Play store has a payment screen with multiple payment gateways. Users can make the payment with any gateway. After the payment, there will be an acknowledgment pop-up stating the status of the purchase.

This problem seems to be simple yet, it’s get complicated over the time with multiple gateways have multiple states. …


Create your own DI framework

Laptop screen
Laptop screen
Photo by Sigmund on Unsplash.

There are numerous resources available for developers to implement DI in Android applications. But when it comes to DI in an Android library, I only found a few — and only a couple of those are actually useful.

So I decided to write an article on why and how I implemented manual dependency injection in an Android library. My experience with DI in libraries goes back to 2018 when the company that I work for made a deal with one of the industry leaders. They now wanted a part of our application to include their applications as a library.

What…


Photo by Rod Long on Unsplash

Introduction

Handling configuration changes regarding data management have been made easy with introduction of ViewModels. But when you think of unforeseen situations like process death, even viewmodels are of no use.

To be frank in most of the cases, viewmodel objects and the onSaveInstanceState() method will do the trick, but when it comes to providing smooth and snappy UI to the users, pro developers should take process death into consideration, mainly when you’re supporting low end devices.

This is where the Savedstate module comes handy, ViewModel objects receive a SavedStateHandle object via constructor. This object is a key-value pair like hash-map…


Infix, inline, and more

Photo by Marc Reichelt on Unsplash

Introduction

With the introduction of Kotlin in Android development, we all end up with those Util files containing all sorts of functions that we use in Android app development.

Util files is not a new kid on the block, but the functional capability of Kotlin makes it fancyier and more optimized than ever. We all know Kotlin is as much a functional programming language as it is object-oriented.

In my experience, I’ve used the object-oriented capabilities of Kotlin to create base classes and implement complex architectures. But when it comes to functional capabilities Kotlin is far handier. …


Implement Dependency Injection in Android library using Dagger2

Scissors with spider logo on them
Scissors with spider logo on them
Photo by Jimmy Chang on Unsplash

Take away from this article

In this article, you’re going to learn how to implement dependency injection in the Android library using Dagger2. The focus of this article is AAR library format, but the process we follow here can be applied to any library format.

Introduction

Dependency injection is another way classes acquire references of other classes. For example, there’s a class BananaMilkshake, which may require theMilk class. Here, BananaMilkShake is dependent on the Milk class. Often these required classes, like Milk, are called as dependencies.

Implementing dependency injection provides you with the following advantages:

  • Reusability of code
  • Ease of refactoring
  • Ease of testing

There are…


Build awesome Android applications

Devices on desk
Devices on desk
Photo by AltumCode on Unsplash.

In this article, we’re going to learn about the Scaffold and Slot APIs and how to use them to design a fully functional screen in an Android application. You’ll learn how to create a top bar, a bottom navigation view, a drawer, and the main content of the screen. Most importantly, you’ll learn how Scaffold holds all of them together.

At the end of this article, you’ll find the Github project. Feel free to explore the code.

Introduction

Jetpack Compose is one of the recent attempts from Google to make it easy for Android developers to build UI.

“Jetpack Compose is…


Photo by Luke Chesser on Unsplash

Take away from this article

In this article, you’ll learn how maintain a remote sub-module in android projects. A remote sub-module is an android library module hosted on git as a repository that can be added as a sub-module to several projects. Along with that you’ll also learn why we need a remote sub-module and how to create one.

What’s a sub-module?

Let’s start from the basics, Consider an application with huge code-base and being maintained like forever. If you’re an android developer for a while, you would know the importance to separate things based on the purpose.

Consider a house without divisions like bedroom, kitchen, etc. I…


Photo by NEXT Academy on Unsplash

Take away from this article

In this article, you’re going learn how to access data in user google drive via Google Drive API. First we’ll start by accessing the existing files in the drive then continue to upload a new file and finally how to download a file from drive.

Introduction

In this modern era all most every android app need some kind of storage where they can store the data related to users. With increases in paranoiya of security users don’t trust remote servers anymore. …

Siva Ganesh Kantamani

Learn. Code. Write. Repeat. Visit me at https://about.me/sivaganesh_kantamani & Join my email list at https://sgkantamani.substack.com/p/subscribe

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