【发布时间】:2015-05-18 04:30:07
【问题描述】:
我是接口新手,我正在尝试执行以下操作。我错过了什么?
public class MyAdapter implements ItemManager.DoThisInterface {
...
@Override
doThis() {
// Do things specific to my adapter. Define action hre.
}
}
接口是在Item Manager中定义的,不知道需要做什么。适配器应该定义动作。
public class ItemManager {
....
private void onCertainEvent() {
doThis(); // do whatever is overriden in adapter.
// this is kind of a placeholder for what i expect to be defined
// in the adapter.
// (this fails to compile because it can't call straight to the interface method)
}
// interface declaration
public interface DoThisInterface {
doThis();
}
}
【问题讨论】:
标签: android interface callback