'How can i pass an activity instance to another class using a interface with Hilt annotations?

How can i translate this code to Hilt annotations?

class PedidoCarteiraActivity : BaseKotlinAppCompatActivity(), IPedidoCarteiraView {

private val presenter: IPedidoCarteiraPresenter = PedidoCarteiraPresenter(this, this) }


interface IPedidoCarteiraPresenter {}

class PedidoCarteiraPresenter(val activity: IPedidoCarteiraView, val context: Context): IPedidoCarteiraPresenter {}

This way i can call the methods from activity on my PedidoCarteiraPresenter class. I already tried using only the context so i can cast it to the Activity but i dont think that is the right way to do that.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source