Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Problem when getting context in android Custom View inflated in Fragment #14

Open
EssidM opened this issue Feb 11, 2021 · 2 comments
Open

Comments

@EssidM
Copy link

EssidM commented Feb 11, 2021

Hello,
I have the following configuration using Hilt 2.32-alpha, I set up the annotation @androidentrypoint on a Fragment. This fragment declares a custom view in it's layout.

The problem occurs when I was trying to get context (basically activity) from inside the Custom view class and I'm getting FragmentContextWrapper: this class is not intended to be used outside the Hilt components as mentioned in the documentation.

So I'm trying to figure out how to get the context correctly or if I'm doing something wrong in the hilt implementation ?
Otherwise, I want to verify if this is this is a know bug in the hilt implementation.

Thank for your help.
Messid

@manuelvicnt
Copy link
Contributor

I think this issue should be filed in https://github.com/google/dagger if this is still happening. Can you inject @ActivityContext?

@abrolrahul
Copy link

Filed it in google/dagger#3417

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants