Creating too many threads can actually make an application underperform in some situations; threads are objects which impose overhead during object allocation and garbage collection.

To overcome these issues, Kotlin introduced a new way of writing asynchronous, non-blocking code; the Coroutine.

Similar to threads, coroutines can run in concurrently, wait…

Part 3 ( Hilt modules )

Sometimes a type cannot be constructor-injected. This can happen for multiple reasons. For example:

  1. You also cannot constructor-inject a type that you do not own, such as a class from an external library.
  2. You cannot constructor-inject an interface.

In these cases, you can provide Hilt with binding information by using…

Part 2 ( Field injection )

Step 1. Inject dependencies into Android classes

Add @AndroidEntryPoint whenever you want to inject fields

Note: If you annotate an Android class with @AndroidEntryPoint, then you also must annotate Android classes that depend on it. …

Part 1 ( Introduction )

Content

What is dependency injection?

What is Hilt?

How to setup Hilt?

What is dependency injection?

Dependency means that one class use another class

Dependency injection means instead of each instance of Object1 constructing its own Object2 on initialization, it receives an Object2 as a parameter in its constructor

Noha Samir

Android Developer

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