I have two activities: MainActivity extends ListActivity
and Preferences implements BillingController.IConfiguration
.
Now I need to call BillingController.someMethod(this)
at MainActivity
. Such call can be made only if MainActivity implements BillingController.IConfiguration
. But this is already implemented at Preferences
class. What can I do to avoid implementing that again?
Make a class that implements BillingController.IConfiguration
and use it inside both MainActivity
and Preferences
to delegate method calls to it.
Do an instance of check.
if (instance instanceof BillingController.IConfiguration) {
((BillingController.IConfiguration)instance).someMethod(this);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.