To reduce dependece of class, I want to send parameter (using generic class) to constructor that extends some class and implements interface, for example
public
T must extend Fragment and implement SomeInterface
In that case you could declare SomeClass
as the following:
public class SomeClass
That would require an object of type T
to both extend Fragment
and implement SomeInterface
.
Further, using my T class, I want to create views, using T.getActivity() as Context.
I'm unfamiliar with Android, but if getActivity()
is a public instance method declared in Fragment
then will be entirely possible to call it on an instance of T
, since the compiler will know all T
s must inherit that method.