Dependency Injection based Android interview questions and answers
WHAT IS DEPENDENCY INJECTION? DO YOU USE ANY DI LIBRARY IN YOUR PROJECT? CAN YOU NAME A FEW OF THEM, AND WHY ONE IS BETTER THAN OTHERS? Dependency Injection is a design pattern to implement inversion of control, and to resolve dependencies. Dependency Injection (DI) eliminates boilerplate code (for example, by removing listener) and provides a much cleaner and effective code. There are a few DI libraries used in Android development: -Dagger -ButterKnife -RoboGuice ButterKnife and Dagger do not use reflection, but rather compile time annotations. They are therefore faster to develop with. What is dependency injection? Is a pattern for resolving dependency. It is an implementation of dependency inversion principle (DIP). Some of the libraries to enable dependency injection for are, AndroidAnnotations Butter Knife Dagger Dagger2 RoboGuice Dagger Component Vs Subcomponent Component dependencies — Use this when you want to keep two components independent. Subcomponents — Use this when y...