Android Interview Questions Series — Part II— Android, DI

Abhishek Jain
Tech Insider
Published in
4 min readJul 29, 2020

Part I link : Android Interview Questions Series — Part I — Core Java, Multithreading and Kotlin

Android Basics

  1. Android Application components: Activities, Services, Broadcast Receivers, Content Providers
  2. Activity LifeCycle, Fragment LifeCycle
  3. Fragment Lifecycle during Fragment Transaction
  4. Task Affinity, Launch Modes: The task that the activity has an affinity for. Activities with the same affinity conceptually belong to the same task (to the same “application” from the user’s perspective). The affinity of a task is determined by the affinity of its root activity. Launch Modes: “standard"
    "singleTop"
    "singleTask"
    "singleInstance"

5. Retention fragment- setRetainInstance(true): The Fragment’s state will be retained (and not destroyed!) across configuration changes (e.g. screen rotate). The state will be retained even if the configuration change causes the “parent” Activity to be destroyed. However, the view of the Fragment gets destroyed. setRetainInstance(true) is especially useful for long-running operations inside Fragments that do not care about configuration changes.

6. Headless fragment: Regular Fragment that returns null in onCreateView() and have setRetainInstance(true) in onCreate()

7. What is Async Task

8. Retaining Async Task while configuration change: host your AsyncTask inside a Fragment, call setRetainInstance(true) on the Fragment, and report the AsyncTask's progress/results back to it's Activity through the retained Fragment

9. Serialization vs Parcelable

10. How does Parcelable work

11. What are content providers: Content providers can help an application manage access to data stored by itself, stored by other apps, and provide a way to share data with other apps

12. Intent vs sticky Intent vs pending Intent

13. Implicit intent vs Explicit intent

14. Background service, Foreground Service and Bound Service

15 Lifecycle of Service — bound and Intent

16. What is Intent Service

17. Service Execution limits

18. Internal Working of RecylerView

19. setRecycledViewPool method in RecyclerView: In the case of nested recyclerView

20. Communication between Services and Activity

21. Communication between Two fragments

22. Bound Service using Messenger

23. What is BroadCast Reciever? Local vs global BroadCastreciever: Broadcast receiver is an Android component that allows you to send or receive Android system or application events.

24. Looper, Handler, and Handler Thread

25. Understanding Memory Leaks

26. Firebase Performance Monitoring

Architecture Components

  1. What are Android Architecture components: Android architecture components are a collection of libraries that help you design robust, testable, and maintainable apps.
  2. What are ViewModel and How do they work on Android? : Aclass is designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations.
  3. What is LiveData?: It is an observable data holder class. Unlike a regular observable, LiveData is lifecycle-aware, meaning it respects the lifecycle of other app components, such as activities, fragments, or services.
  4. How ViewModels are Retained?
  5. What is Data Binding: It helps in declaratively binding UI elements to in our layout to data sources of our app
  6. Difference b/w MVP, MVC, MVVM Design patterns
  7. How to make Presenter of MVP, lifecycle Aware
  8. Explain Live Data TransFormations
  9. Explain WorkManger: It manages every background jobs in Android with the circumstances we choose
  10. Explain Room Persistence Library: It is an SQLite object mapping library. Use it to Avoid boilerplate code and easily convert SQLite table data to Java objects
  11. Explain App Architecture, Explain Clean Architecture in detail.
  12. Battery Optimisation Technique for Android App

Dependency Injection(Refer this blog)

  1. What is Dependency Injection and Why to do that? : Reduced Dependencies:Classes often require references to other classes. For example, a Car class might need a reference to an Engine class. These required classes are called dependencies, and in this example the Car class is dependent on having an instance of the Engine class to run. Advantages: Reduced Dependency Carrying, More Reusable Code, More Testable Code, More Readable Code
  2. Explain Dagger component, module, provider, scope, subcomponent, etc
  3. How to Inject values at run time in dagger
  4. What is Custom Scope in dagger
  5. What is the difference between @Provides and @Binds statement
  6. Component Vs Subcomponent: Component dependencies — Use this when you want to keep two components independent. Subcomponents — Use this when you want to keep two components coupled.
  7. Can a subcomponent have multiple parents: No
  8. Dependent component and Subcomponent
  9. Dagger — hilt

Part I link : Android Interview Questions Series — Part I — Core Java, Multithreading and Kotlin

References: Geeks for Geeks, Tutorials Point and, StackOverflow, Wikipedia, Edureka,MindOrks

--

--

Abhishek Jain
Tech Insider

Android dev | Software developer at InMobi, Ex- MMT, Tokopedia