If you have not used the ARouter you try to follow this blog below and then look at the use of content components that communicate down (otherwise might be forced to rip off) Android Studio ARouter access and simple to use
If you've used ARouter please continue to read:
A sub-module defines an inheritance ISkill master interface module in communication IProvider from
2 ISkill master module defines a class that implements ISkillImpl
3 to acquire sub-module to instantiate an object of this ISkillImpl reflected by ARouter +
4 communicates by way of example of the object 3
Theory is boring, let's look at the code
1 define a sub-module interface inherits from the communication master module ISkill IProvider
public interface ISkill extends IProvider { public void eat(); }
2 defines a main module implementation class ISkill ISkillImpl, annotate attention! !
@Route(path = "/app/ISkillImpl") public class ISkillImpl implements ISkill { @Override public void eat() { Log.i("TAG", "大王叫我来巡山!"); } @Override public void init(Context context) { } }
Example 3 obtaining sub-module object of this ISkillImpl by ARouter
ISkill impl=ARouter.getInstance().build("/app/ISkillImpl").navigation(); impl.eat();