[英]Call overridden method of Activity from other class
Hi I have an Interface
and an Activity
. 嗨,我有一个Interface
和一个Activity
。
My Activity implements that Interface and have overrided the method of Interface. 我的活动实现了该接口,并覆盖了接口的方法。
now I have to call that overridden method of Interface from another Class so that overridden method of Activity gets executed. 现在,我必须从另一个类调用该接口的重写方法,以便执行活动的重写方法。
Thanks in advance... 提前致谢...
我可以从其他类中调用Activity的重写方法为
((name of Interface) context).documentRead(dataUnit);
just share the reference of the activity implementing the interface as the object of interface and then simply call the overridden method on that reference . 只需共享实现接口的活动的引用作为接口的对象,然后简单地在该引用上调用被覆盖的方法 。 Basic OOP concept. 基本的OOP概念。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.