# dagger-hilt

Hilt is an Android dependency-injection library built on Dagger that reduces manual dependency-injection boilerplate.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Forget the "Setup Tax": A Production-Ready Multi-Module Android Template

DevFeed: [Forget the "Setup Tax": A Production-Ready Multi-Module Android Template](<https://devfeed.tech/articles/forget-the-setup-tax-a-production-ready-multi-module-android-template-22945.md>)

Original publisher: [Read original article](<https://proandroiddev.com/forget-the-setup-tax-a-production-ready-multi-module-android-template-f4c879c97205?source=rss----c72404660798---4>)

Author: Shamil Gulmetov

Published: 2026-09-09T01:34:18Z

Content type: article

Language: en

Sources: [ProAndroidDev](<https://devfeed.tech/sources/proandroiddev-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Gradle](<https://devfeed.tech/topics/gradle.md>), [software-architecture](<https://devfeed.tech/topics/software-architecture.md>), [Android Studio](<https://devfeed.tech/topics/android-studio.md>), [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Design system](<https://devfeed.tech/topics/design-system.md>), [workflow automation](<https://devfeed.tech/topics/workflow-automation.md>), [Dark Mode](<https://devfeed.tech/topics/dark-mode.md>), [now-in-android](<https://devfeed.tech/topics/now-in-android.md>), [Terminal](<https://devfeed.tech/topics/terminal.md>)

Tags: [analysis](<https://devfeed.tech/tags/analysis.md>), [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [android-architecture](<https://devfeed.tech/tags/android-architecture.md>), [android-studio](<https://devfeed.tech/tags/android-studio.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [automation](<https://devfeed.tech/tags/automation.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [coding-standards](<https://devfeed.tech/tags/coding-standards.md>), [command](<https://devfeed.tech/tags/command.md>), [compose](<https://devfeed.tech/tags/compose.md>), [convention-plugins](<https://devfeed.tech/tags/convention-plugins.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [custom](<https://devfeed.tech/tags/custom.md>), [dark-theme](<https://devfeed.tech/tags/dark-theme.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [design](<https://devfeed.tech/tags/design.md>), [gradle](<https://devfeed.tech/tags/gradle.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [module](<https://devfeed.tech/tags/module.md>), [production](<https://devfeed.tech/tags/production.md>), [setup](<https://devfeed.tech/tags/setup.md>), [template](<https://devfeed.tech/tags/template.md>)

### AI overview

The Android Architecture Template packages patterns inspired by Google's Now in Android into a starter foundation without its sample app's news features. It organizes code into app, core, feature, build-logic, and lint modules; Kotlin convention plugins centralize Gradle configuration, while custom lint detectors enforce design system usage and test naming. The excerpt also describes shared Compose design tokens and themes, Hilt-qualified coroutine dispatchers and application scopes, and Flow helpers for result handling and UI StateFlow conversion. To create a branded copy, developers use the GitHub template and run `py init_project.py com.newbrand.app`; the script updates package references and Gradle identifiers and restructures Java or Kotlin source paths. The description does not establish independent validation of its production readiness or automation claims.

### Source excerpt

How to streamline your development workflow with pre-configured Kotlin Convention Plugins, custom Lint rules, and unified design system tokens. Creating a new Android application from scratch in modern engineering is rarely as simple as clicking File -> New -> New Project in Android Studio. Before writing a single line of business logic, developers face hours -- or even days -- of repetitive infrastructure setup: Configuring a scalable multi-module architecture. Setting up Gradle Version Catalogs and writing custom Kotlin Convention Plugins to eliminate build script duplication. Standardizing design tokens and dark theme support in Jetpack Compose. Wiring up Hilt Dependency Injection for Coroutine Dispatchers, network, and Application Scopes. Enforcing architectural boundaries and team coding standards using custom static analysis (Lint) rules. Google's official Now in Android (NiA) repository is the recognized gold standard for modern Android engineering. However, because NiA is a full-featured showcase app with domain logic (news feeds, authors, bookmarks, offline sync), using it as a starter kit is cumbersome: developers must strip out existing features while risking breaking build pipelines. This Android Architecture Template bridges that gap: a clean, production-ready starter kit that extracts NiA's best architectural patterns into an isolated foundation. To make it enterprise-ready with zero room for error, it includes a standalone automation tool. Instead of manual refactoring, run a single terminal command to rename and brand the entire architecture in seconds. Acknowledgments & Credits Core architectural decisions, build-logic convention plugins, and static analysis infrastructure in this template are directly inspired by Google's official Now in Android (NiA) repository. Rather than reinventing the wheel, this template focuses on developer ergonomics--making Google's best practices instantly usable out of the box. 1. Modular Project Architecture The repository

## Hilt in Android Auto: From Manual Factories to a Cleaner Screen Provider

DevFeed: [Hilt in Android Auto: From Manual Factories to a Cleaner Screen Provider](<https://devfeed.tech/articles/hilt-in-android-auto-from-manual-factories-to-a-cleaner-screen-provider-22963.md>)

Original publisher: [Read original article](<https://funkymuse.github.io/posts/car-sample-with-hilt/>)

Author: FunkyMuse

Published: 2026-06-05T09:30:00Z

Content type: tutorial

Language: en

Sources: [FunkyMuse](<https://devfeed.tech/sources/funkymuse.md>)

Topics: [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [Android Auto](<https://devfeed.tech/topics/android-auto.md>), [Dagger](<https://devfeed.tech/topics/dagger.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-auto](<https://devfeed.tech/tags/android-auto.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [dependency](<https://devfeed.tech/tags/dependency.md>), [dependency-management](<https://devfeed.tech/tags/dependency-management.md>), [di](<https://devfeed.tech/tags/di.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [screen](<https://devfeed.tech/tags/screen.md>)

### AI overview

The excerpt proposes using Hilt multibinding to avoid manually passing a factory for every Android Auto screen. A `ScreenProvider` resolves screens from a map of `ScreenFactory` bindings, and a `Navigator` uses that provider to push screens; the session uses the provider for the initial screen. Screens can then use ordinary constructors and the navigator, without `@AssistedInject` factories. Because a `MainScreen` factory needs the navigator while the navigator depends on the screen provider and its factory map, injecting `Provider<Navigator>` delays resolution and breaks the circular dependency. The author presents this as an exploratory approach, not production-ready: `ScreenFactory` uses `Any` casts that could be improved with a custom KSP processor. The excerpt also mentions event channels or callbacks as alternatives for breaking the cycle, and says `Lazy` is possible but offers no significant improvement over `Provider`.

### Source excerpt

If you've ever followed the Android Auto Codelabs, you've seen the "sample" way of building a Car App. It works, it's functional, but as soon as you try to scale it beyond a simple demo, you hit a wall: Dependency Management. Keep in mind this is only one way to wire things, I'm pretty sure many others exist, I'm exploring things on Android Auto and Android Wear lately and how to connect and w...

## Introducing the Koin Migration Skills

DevFeed: [Introducing the Koin Migration Skills](<https://devfeed.tech/articles/introducing-the-koin-migration-skills-22970.md>)

Original publisher: [Read original article](<https://blog.insert-koin.io/introducing-the-koin-migration-skills-0b4be9c819cc?source=rss----925561f2ecdf---4>)

Author: Arnaud Giuliani

Published: 2026-04-22T13:23:59Z

Content type: release

Language: en

Sources: [Koin developers](<https://devfeed.tech/sources/koin-developers-medium.md>)

Topics: [koin](<https://devfeed.tech/topics/koin.md>), [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [bridging](<https://devfeed.tech/tags/bridging.md>), [claude](<https://devfeed.tech/tags/claude.md>), [claude-code](<https://devfeed.tech/tags/claude-code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [dagger](<https://devfeed.tech/tags/dagger.md>), [dagger-hilt](<https://devfeed.tech/tags/dagger-hilt.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [di](<https://devfeed.tech/tags/di.md>), [dsl](<https://devfeed.tech/tags/dsl.md>), [github](<https://devfeed.tech/tags/github.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [human-in-the-loop](<https://devfeed.tech/tags/human-in-the-loop.md>), [install](<https://devfeed.tech/tags/install.md>), [inventory](<https://devfeed.tech/tags/inventory.md>), [kodein](<https://devfeed.tech/tags/kodein.md>), [koin](<https://devfeed.tech/tags/koin.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [ksp](<https://devfeed.tech/tags/ksp.md>), [mapping](<https://devfeed.tech/tags/mapping.md>), [migration](<https://devfeed.tech/tags/migration.md>), [skills](<https://devfeed.tech/tags/skills.md>)

### AI overview

The Koin Migration Skill is an open-source Claude Code plugin for moving Kotlin and Android projects to Koin 4.x, with the Koin Compiler Plugin when possible. It supports migrations from Hilt, Dagger, Toothpick, Kodein, older Koin versions, classic Koin DSL, and Koin KSP annotations. It inventories modules and bindings, ranks them by complexity and dependencies, then recommends a leaf-first sequence. Migrations proceed module by module, with the old container kept alongside Koin and Hilt bindings bridged through koin-android-dagger or @EntryPoint bridges. Before editing files, the skill presents a plan and asks about key choices, including whether to make a project-wide Kotlin version update or use Safe DSL without the compiler plugin. Its stated safeguards include per-module, configuration-group, and full-graph compile-time checks, which can be temporarily disabled. The excerpt also notes KMP support and modern Koin conventions.

### Source excerpt

Hello all 👋 Migrating a Kotlin or Android project between DI frameworks (Hilt, Dagger, Toothpick, Kodein, or older Koin versions) is one of those strategic refactors that every team puts off. It touches every module, the call sites are everywhere, and the migration plan never quite survives contact with the real codebase. We wanted to take the pain out of it. So we built the Koin Migration Skill: a Claude Code plugin that automates DI migrations to Koin 4.x and the Koin Compiler Plugin, module by module, with compile-time verification and a human-in-the-loop at every step. Koin Migration Project -- 1.0.0What it covers Initially, this project is intended to help Koin developers to migrate to use the new Koin Compiler Plugin. The skill supports every realistic migration path into modern Koin, with Koin Compiler if possible. This uses either annotations or the safe DSL: Hilt -> Koin (with koin-android-dagger bridging during migration) Dagger -> Koin Toothpick -> Koin Kodein -> Koin Koin 3.x -> Koin 4.x upgrade Classic Koin DSL -> Safe DSL Koin KSP Annotations -> Koin Compiler Plugin All paths converge on the same target: Koin 4.x with Annotations or Safe DSL, powered by the Koin Compiler Plugin for compile-time DI graph verification. How it works Project documentation is available: https://github.com/InsertKoinIO/koin-migration. Point Claude at your project and describe what you want to migrate. /plugin marketplace add InsertKoinIO/koin-migration /plugin install koin-migration@koin-migrationAdding Skill in current project The skill opens with a full inventory of your DI setup: every module, binding, qualifier, and scope. It immediately produces a ranked migration table. The NowInAndroid project below has 35 DI files across core, feature, app, and sync layers. The skill maps each one: bindings count, downstream dependants, complexity rating, and a recommended order. Modules inventory, DI features usage and mapping You can't go "big-bang" in that kind of approach. You need to st

## From Dagger to Metro

DevFeed: [From Dagger to Metro](<https://devfeed.tech/articles/from-dagger-to-metro-20445.md>)

Original publisher: [Read original article](<https://vinted.engineering//2026/02/12/from-dagger-to-metro/>)

Author: Andrius Semionovas

Published: 2026-02-12T00:00:00Z

Content type: article

Language: en

Sources: [Vinted](<https://devfeed.tech/sources/vinted.md>)

Topics: [Dagger](<https://devfeed.tech/topics/dagger.md>), [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [anvil](<https://devfeed.tech/tags/anvil.md>), [dagger](<https://devfeed.tech/tags/dagger.md>), [dagger-android](<https://devfeed.tech/tags/dagger-android.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [di](<https://devfeed.tech/tags/di.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [metro](<https://devfeed.tech/tags/metro.md>), [migration](<https://devfeed.tech/tags/migration.md>)

### AI overview

Vinted migrated its Android codebase, spanning a few hundred Gradle modules, from Dagger and Anvil to Metro as Anvil's Kotlin compiler plugin support left the team on Kotlin 1.9/K1 without incremental compilation while Kotlin 2.x and K2 adoption became pressing. The excerpt presents Metro's interoperability with Dagger, Anvil, and kotlin-inject as the key migration advantage: it let the team adopt K2 with less business-code migration than other options, reducing the time and risk of the change. The account describes the migration as bumpy; the excerpt does not provide its implementation steps or full results.

### Source excerpt

Metro - modern and kotlin injection framework created by Zac Sweers. And we, Android developers at Vinted, officially and fully migrated to it! It was quite a bumpy ride for our huge codebase. Our story begins...

## What Every Android Developer Should Have in Their GitHub?

DevFeed: [What Every Android Developer Should Have in Their GitHub?](<https://devfeed.tech/articles/what-every-android-developer-should-have-in-their-github-25844.md>)

Original publisher: [Read original article](<https://blog.stackademic.com/what-every-android-developer-should-have-in-their-github-de8deab051b9?source=rss-8aced922ece------2>)

Author: Ban Markovic

Published: 2024-02-05T11:00:04Z

Content type: article

Language: en

Sources: [Ban Markovic](<https://devfeed.tech/sources/stories-by-ban-markovic-on-medium.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [GitHub](<https://devfeed.tech/topics/github.md>), [MVVM](<https://devfeed.tech/topics/mvvm.md>), [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [Dagger](<https://devfeed.tech/topics/dagger.md>), [REST API](<https://devfeed.tech/topics/rest-api.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [asynchronous-communication](<https://devfeed.tech/tags/asynchronous-communication.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [dagger](<https://devfeed.tech/tags/dagger.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [fetching](<https://devfeed.tech/tags/fetching.md>), [github](<https://devfeed.tech/tags/github.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [koin](<https://devfeed.tech/tags/koin.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [livedata](<https://devfeed.tech/tags/livedata.md>), [mvi](<https://devfeed.tech/tags/mvi.md>), [mvvm](<https://devfeed.tech/tags/mvvm.md>), [navigation](<https://devfeed.tech/tags/navigation.md>), [portfolio](<https://devfeed.tech/tags/portfolio.md>), [rest-api](<https://devfeed.tech/tags/rest-api.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [unit-tests](<https://devfeed.tech/tags/unit-tests.md>)

### AI overview

The article recommends a compact Android GitHub showcase with two screens: fetch a list from a REST API, display it, and let users open an item's details. It advises demonstrating either MVI or MVVM, organizing files by feature or type, handling asynchronous work with a library such as Kotlin Coroutines, LiveData, or RxJava, and using dependency injection with Hilt, Dagger, or Koin. It also recommends unit tests for ViewModel, UseCase, and Repository classes. The article presents these as ways to show core Android development skills to potential employers; it does not compare the listed architecture or library options.

### Source excerpt

In the competitive world of Android development, having a strong GitHub portfolio is crucial for showcasing your skills to potential employers. One effective way to demonstrate your expertise is by creating a concise yet comprehensive project that highlights key aspects of Android development. In this article, we'll explore the essential components that every Android developer should have in their GitHub, focusing on a project that encapsulates fundamental skills. The Project Overview A successful showcase project should include two screens and cover the following key functionalities: Fetching and Displaying Data - Utilize a REST API to fetch a list of items. - Display this list on the first screen of the app. Navigation and Detailed Information - Enable users to navigate to a second screen by clicking on a specific item. - On the second screen, display more detailed information about the selected item. Key Considerations for the Showcase ProjectArchitecture -- MVI or MVVM Clearly implement and showcase your understanding of the chosen architecture (MVI or MVVM). Organize code files in a logical and easily understandable structure. File Organization Demonstrate a well-organized project structure, separating concerns and making codebase easily maintainable (feature-based or type-based folders structure). Asynchronous Communication Showcase your proficiency in handling asynchronous tasks by using an appropriate library (e.g., Kotlin Coroutines, LiveData, RxJava). Unit Tests Impress potential employers by including unit tests to validate the functionality of critical components (cover your ViewModel, UseCase, Repository classes with unit tests). Dependency Injection (DI): Implement and demonstrate your use of dependency injection for managing component dependencies (Hilt, Dagger, Koin). Why This Project Matters This concise project effectively showcases your abilities in: Displaying a list of items Fetching data from the internet Implementing navigation between screens

## Dependency Injection in Legacy Code

DevFeed: [Dependency Injection in Legacy Code](<https://devfeed.tech/articles/dependency-injection-in-legacy-code-24906.md>)

Original publisher: [Read original article](<https://blog.blundellapps.co.uk/dependency-injection-in-legacy-code/>)

Author: blundell

Published: 2023-10-19T12:26:59Z

Content type: tutorial

Language: en

Sources: [Blundell](<https://devfeed.tech/sources/blundell.md>)

Topics: [Dependency injection](<https://devfeed.tech/topics/dependency-injection.md>), [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [Android](<https://devfeed.tech/topics/android.md>), [Dagger](<https://devfeed.tech/topics/dagger.md>), [legacy systems](<https://devfeed.tech/topics/legacy-systems.md>), [software-development](<https://devfeed.tech/topics/software-development.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [dagger](<https://devfeed.tech/tags/dagger.md>), [dagger-hilt](<https://devfeed.tech/tags/dagger-hilt.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [di](<https://devfeed.tech/tags/di.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [intermediate](<https://devfeed.tech/tags/intermediate.md>), [legacy-code](<https://devfeed.tech/tags/legacy-code.md>), [reference](<https://devfeed.tech/tags/reference.md>)

### AI overview

For Android legacy singletons or other classes outside the architecture managed by Hilt, the excerpt describes using a Hilt EntryPoint to retrieve dependencies from the existing Dagger graph. Define an interface annotated as an entry point, add a function for each required binding (including qualifiers), and install it in the appropriate component. The legacy code can then use the entry point through a Context reference. The approach assumes the required Dagger modules and bindings already exist; the excerpt says it does not work if the class cannot obtain a Context.

### Source excerpt

This post explains how you can inject dependencies into Android legacy singletons, or any classes that aren't conforming to your current Android architecture, using Dagger & Hilt. I'll cut straight to the chase, if you have a reference to Context, (which you usually always do in spaghetti legacy code) then you can use your normal [...] The post Dependency Injection in Legacy Code first appeared on Blundell.

## Slim down your Android components with LifecycleObserver

DevFeed: [Slim down your Android components with LifecycleObserver](<https://devfeed.tech/articles/slim-down-your-android-components-with-lifecycleobserver-22657.md>)

Original publisher: [Read original article](<https://www.valueof.io/blog/default-lifecycle-observer>)

Author: james shvarts

Published: 2022-11-17T21:11:40Z

Content type: tutorial

Language: en

Sources: [Android Blog - Mobile Dev Notes](<https://devfeed.tech/sources/android-blog-mobile-dev-notes.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [Dagger](<https://devfeed.tech/topics/dagger.md>), [software-development](<https://devfeed.tech/topics/software-development.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-development](<https://devfeed.tech/tags/android-development.md>), [custom](<https://devfeed.tech/tags/custom.md>), [dagger](<https://devfeed.tech/tags/dagger.md>), [dagger-hilt](<https://devfeed.tech/tags/dagger-hilt.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [lifecycle](<https://devfeed.tech/tags/lifecycle.md>)

### AI overview

A custom LifecycleObserver can move lifecycle callbacks out of oversized Android components. Implement the observer interface and override only the callbacks you need, then register it with an Activity or Fragment lifecycle; observe a Fragment's view lifecycle through its viewLifecycleOwner, which is unavailable in onCreate. Observers need not be explicitly removed, and multiple observers can organize or share lifecycle work. The excerpt also describes observing the Application/process lifecycle and says the observer can be injected with Dagger or Hilt, but its scoping discussion is truncated, so it does not establish how to configure or reuse scoped instances.

### Source excerpt

Learn to create custom LifecycleObserver components and inject them with Dagger/Hilt

## Using an Activity from a Hilt ViewModel

DevFeed: [Using an Activity from a Hilt ViewModel](<https://devfeed.tech/articles/using-an-activity-from-a-hilt-viewmodel-25634.md>)

Original publisher: [Read original article](<https://blog.p-y.wtf/using-an-activity-from-a-hilt-viewmodel>)

Author: Pierre-Yves Ricau

Published: 2022-09-07T21:59:49Z

Content type: tutorial

Language: en

Sources: [Py's blog](<https://devfeed.tech/sources/py-s-blog.md>)

Topics: [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [software-development](<https://devfeed.tech/topics/software-development.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [dagger-hilt](<https://devfeed.tech/tags/dagger-hilt.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

### AI overview

The excerpt presents a Hilt workaround for accessing the current Activity from a ViewModel without injecting the Activity directly, which could leak across configuration changes. It stores the Activity in a scoped provider, exposes that provider through an Activity-scoped Hilt entry point, and updates the reference through lifecycle callbacks. The approach checks that the Activity is Hilt-aware and is described as supporting multiple simultaneously created Activities while reusing the logical component across configuration recreation. The excerpt omits code and identifiers, so implementation details cannot be fully assessed.

### Source excerpt

👋 Hi, this is P.Y., I work as an Android Engineer at Block. This blog shares a bit of hackery to be able to access an activity instance within a Hilt ViewModel. If you come up with other interesting

## Input validation in Jetpack Compose

DevFeed: [Input validation in Jetpack Compose](<https://devfeed.tech/articles/input-validation-in-jetpack-compose-25897.md>)

Original publisher: [Read original article](<https://proandroiddev.com/input-validation-in-jetpack-compose-e99c18b44fe3?source=rss-56174fa84bcc------2>)

Author: Denys Rudenko

Published: 2021-08-22T16:42:02Z

Content type: tutorial

Language: en

Sources: [Denis Rudenko](<https://devfeed.tech/sources/stories-by-denis-rudenko-on-medium.md>)

Topics: [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>), [Data validation](<https://devfeed.tech/topics/data-validation.md>), [User interface design](<https://devfeed.tech/topics/ui-design.md>), [Process](<https://devfeed.tech/topics/process.md>), [User Experience](<https://devfeed.tech/topics/user-experience.md>), [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [parcelable](<https://devfeed.tech/topics/parcelable.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [android-app-development](<https://devfeed.tech/tags/android-app-development.md>), [androiddev](<https://devfeed.tech/tags/androiddev.md>), [androiddevweekly](<https://devfeed.tech/tags/androiddevweekly.md>), [compose](<https://devfeed.tech/tags/compose.md>), [dagger](<https://devfeed.tech/tags/dagger.md>), [dagger-hilt](<https://devfeed.tech/tags/dagger-hilt.md>), [death](<https://devfeed.tech/tags/death.md>), [error](<https://devfeed.tech/tags/error.md>), [input](<https://devfeed.tech/tags/input.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [name](<https://devfeed.tech/tags/name.md>), [null](<https://devfeed.tech/tags/null.md>), [observable](<https://devfeed.tech/tags/observable.md>), [parcelable](<https://devfeed.tech/tags/parcelable.md>), [process](<https://devfeed.tech/tags/process.md>), [restoration](<https://devfeed.tech/tags/restoration.md>), [save](<https://devfeed.tech/tags/save.md>), [savedstatehandle](<https://devfeed.tech/tags/savedstatehandle.md>), [sealed-class](<https://devfeed.tech/tags/sealed-class.md>), [stateflow](<https://devfeed.tech/tags/stateflow.md>), [switchmap](<https://devfeed.tech/tags/switchmap.md>), [validation](<https://devfeed.tech/tags/validation.md>)

### AI overview

The excerpt shows a Jetpack Compose form that validates name and credit card inputs and restores useful editing state after process death. A Parcelable input wrapper stores each value with an optional error resource ID in SavedStateHandle; StateFlows expose the fields and combine their validity to control whether the continue button is enabled. The ViewModel can validate as users type or defer validation until continue is clicked, and emits one-time events for success or errors. To restore the editing experience, it tracks the last focused field and uses focus requesters, focus events, and the keyboard controller to restore focus and show the keyboard; IME actions move from name to card number. On successful submission it clears focus and hides the keyboard. The excerpt notes a StateFlow/LiveData distinction for switchMap/flatMapLatest scenarios and suggests debouncing as a possible improvement to auto-validation. Examples use Dagger Hilt and Compose 1.3.0-alpha03.

### Source excerpt

This post will not only focus on manual & auto validation of TextField inputs, but also on how to provide a nice UX by handling process death, including highlighting the last focused field upon restoration. https://medium.com/media/7d776a0ec6ff89810e194adf54680973/hrefSetup We'll use composables, viewModels & Dagger Hilt in these samples. Part 1: InputWrapper Let's create a wrapper for inputs, so it can contain both input value and errorId, if there is a validation error. Class is parcelable, so we can save it inside savedStateHandle later. https://medium.com/media/6c74ba5b4f958d63646a819643b45620/hrefPart 2: ViewModel (simplified version)https://medium.com/media/39bf975a63461cd00f68b8360c6a8f6b/href We're getting a stateFlow from the savedStateHandle using .getStateFlow extension. Using savedStateHandle here allows us to retain the latest data after process death happens. You can also use getLiveData, it's a matter of personal preferences unless you plan to perform observable.switchMap/flatMapLatest type of operations, since there is a subtle difference between stateFlow & liveData in such scenarios described here & change proposal created. areInputsValid stateFlow is combining name & creditCardNumber flows into a single one. The results it returns depend on whether input fields are valid or not. It's invoked whenever there is new emition to name or creditCardNumber flows. We'll use it's value to control buttons enabled/disabled state in our composable. _events will be used for one time events emission to the view layer. ScreenEvent is a sealed class representing all of our one time events. onNameEntered & onCardNumberEntered will be invoked when user enters symbols inside the TextField. We find out whether the input is valid by using an InputValidator object. It's returning either a string resource id containing error message, or a null. Latter means that input is valid. We store the new value & errorId using: https://medium.com/media/d9ad9c61328481f3318c143e6daf3

## Providing AssistedInject supported ViewModel for Composable using Hilt

DevFeed: [Providing AssistedInject supported ViewModel for Composable using Hilt](<https://devfeed.tech/articles/providing-assistedinject-supported-viewmodel-for-composable-using-hilt-25742.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/providing-assistedinject-supported-viewmodel-for-composable-using-hilt/>)

Author: Shreyas Patil

Published: 2021-06-29T14:52:48Z

Content type: article

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [dagger-hilt](<https://devfeed.tech/topics/dagger-hilt.md>), [Dependency injection](<https://devfeed.tech/topics/dependency-injection.md>), [Jetpack Compose](<https://devfeed.tech/topics/jetpack-compose.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [dependency-injection](<https://devfeed.tech/tags/dependency-injection.md>), [di](<https://devfeed.tech/tags/di.md>), [hilt](<https://devfeed.tech/tags/hilt.md>), [java](<https://devfeed.tech/tags/java.md>), [jetpack](<https://devfeed.tech/tags/jetpack.md>), [jetpack-compose](<https://devfeed.tech/tags/jetpack-compose.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [learn-coding](<https://devfeed.tech/tags/learn-coding.md>), [pattern](<https://devfeed.tech/tags/pattern.md>), [runtime](<https://devfeed.tech/tags/runtime.md>), [viewmodel](<https://devfeed.tech/tags/viewmodel.md>)

### AI overview

The excerpt describes using a Hilt entry point to obtain an AssistedInject ViewModel factory for a Jetpack Compose screen. AssistedInject allows constructor parameters to be supplied at creation time; the factory creates the ViewModel, and an entry point exposes that factory to Compose code that Hilt cannot inject directly. The excerpt explains that Hilt's usual ViewModel retrieval is different in Compose and says entry points bridge code outside Hilt's injection support. The actual declarations and retrieval call are omitted, so implementation details cannot be summarized.

### Source excerpt

Learn how to provide Hilt ViewModels with AssistedInject to Jetpack Compose Composables for dynamic dependency injection with runtime parameters.