Fg. car assembly line process

Recently, I’ve finished a course “Dependency Injection in Android with Dagger 2 and Hilt” by Vasiliy Zukanov from Udemy and it is one of the best courses I’ve ever taken. He has explained everything from why do we need dependency injection to how to use Dagger and hilt for the same. He literally refactored a project from everything in an activity to providing all services using DI. This article is not about the implementation of an DI framework, it’s about my learnings and understanding about the fundamentals of DI from this course.

Let’s start with what is Dependency Injection and why do we need it?

Consider a basic analogy for this. Suppose you…

If you’re reading this article, I assume you’re in the quest for investments and you want to grow your savings for your short or long-term goals. And if you are a beginner, this article can help you to at least form a perspective about the different investment options.

TL;DR: If you don’t know much about investing, always avoid emotions and try to ask as many questions as possible to at least get enough confidence to invest like how much return it’ll give after maturity, or can you stop in between and what happens then. …

Remember, when your teacher always interrupted you to avoid doing something wrong. We always had two choices, either to ignore it (not realizing its importance) or to consider it for our better future.

Lint is quite similar to our teachers, it’ll alert you while you’re writing your code and let you know how you can fix them. Isn’t it amazing?

If you’re an android developer, there is a high chance that you’ve heard of Data Binding.

Pre-requisite: It’ll be good if you’re already familiar with normal or one-way data-binding.

So, what is two-way data binding?

In one-way data binding, you set a value on an attribute and set a listener that reacts to a change in that attribute. But two-way data binding allows you to directly react to the changes without using listeners.

Let me give you an example. I recently had to add a feature in one of my company’s projects where we ask users to fill some details…

Have you heard of a story in which an old man fixes a ship engine by just tapping with a hammer? Well, if not then you can read it here.

There is a beautiful quote mentioned in the story:

“Effort is important, but knowing where to make an effort makes all the difference!”

Okay, let’s discuss how this is related to our discussion.

So, the android team recently announced in-app review API and its integration is quite simple. You just have to add a dependency in your app-level gradle file:

implementation 'com.google.android.play:core:1.8.0'

And, add this code to launch the review…

We all have used fragments in our app and wrote fragment transactions many times according to our needs. So, the navigation component is another way to handle transactions but it provides few other benefits too.

Some of them are:

  • Handling back action correctly by default
  • Default standard animations and transitions while switching between fragments
  • Passing data between fragments (this is also my favorite).

Okay, now let’s discuss how to integrate it into our app.

First, we’ve to add following dependencies in our app-level build.gradle file:

def nav_version = "2.3.0"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

The recommended way to navigate between destinations…

Alok Bharti

Learning Android | Android Developer @ slice

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