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 interface SomeInterface{
public void someMethod();
}
public class MyFragment extends Fragment implements SomeInterface{
//implementation
}
//here is classs, that I need to create. T must extend Fragment and implements
//SomeInterface. But, I'm afraid, if I'll use MyFragment directly, it will create a
//dependence of SomeClass from MyFragment.
public class SomeClass /*generic?*/ {
public SomeClass(T parent);
}
Is it possible?
Futher, using my T class, I want to create views, using T.getActivity() as Context.
Class
object into a method and inspect it for its implemented interfaces viagetInterfaces()
, as well as obtain/call aConstructor
to make a new instance. But your specific use case is unclear, so it's difficult to figure out how to piece these items together to solve your particular problem.