You may have created an instance of MyAdapter with new instead of typing it.
In this case, I would not recommend introducing LayoutInflater if you do not want to use different implementations of this class, an example is mock LayoutInflater for testing.
Get an instance in the constructor:
inflater = LayoutInflater.from(context);
That would be more efficient. I do not see any benefit from LayoutInflater injections.
Enabling dependencies is fine, but don't use it when it's not needed and slower.
source share