Reputation: 191
I have project structure like
app :
InstantApp :
library:
dynamic-feature1 :
dynamic-feature2 :
dynamic-feature3 :
Now there is some dependency between dynamic-feature1 and dynamic-feature2. Now if i add it as dependency in dynamic-feature2 build.gradle then it will cause cyclic dependency. Above is just one example there are many other cases too. How to handle such dependency conflicts properly or any suggestion ?
Upvotes: 1
Views: 1077
Reputation: 3383
Get a Fragment/Activity or other class from module:
Class class = Class.forName("your.dynamic.module.package.name.classname");
Get a method from your class:
Method method = class.getMethod("GenerateQuestion");
Invoke the method:
method.invoke(objectYouWantToInvokeTheMethodOn);
To get a parent activity of a dynamic feature module's fragment you can do:
@Override
public void onAttach(Context context) {
super.onAttach(context);
activity = (Activity) context;
}
Then you can call a method on that activity.
Upvotes: 0