---
title: "Comment by Eugen Martynov on \"Using an Activity from a Hilt ViewModel\" | Hashnode"
description: "My first thought was that the provider would implement the activity lifecycle callback. So I would just have one line to register it. However, when you have mul"
url: "https://hashnode.com/posts/using-an-activity-from-a-hilt-viewmodel/631914555abe8613b3d2f620/comment/631f50df526d775aa7f65966"
---

[Discussion](https://hashnode.com/posts/using-an-activity-from-a-hilt-viewmodel/631914555abe8613b3d2f620)

Comment [Using an Activity from a Hilt ViewModel](https://hashnode.com/posts/using-an-activity-from-a-hilt-viewmodel/631914555abe8613b3d2f620)

[Eugen Martynov](https://hashnode.com/@emartynov)

[Sep 12, 2022](https://hashnode.com/posts/using-an-activity-from-a-hilt-viewmodel/631914555abe8613b3d2f620/comment/631f50df526d775aa7f65966)

My first thought was that the provider would implement the activity lifecycle callback. So I would just have one line to register it.

However, when you have multiple of them, maybe this is better so you can control the order of the calls or what is the intent?

[Pierre-Yves Ricau](https://hashnode.com/@py)

[Sep 12, 2022](https://hashnode.com/posts/using-an-activity-from-a-hilt-viewmodel/631914555abe8613b3d2f620/comment/631f50df526d775aa7f65966#reply-631f5c326c86d75accc7e627)

Yeah the general idea here is that this ensures you add an activity to a specific activity stack, rather than starting it from a random live activity or from the application context which isn't tied to a specific activity stack.
