Mosby 框架 - getView 导致 ClassCastException

Mosby Framework - getView cause ClassCastException

我刚刚创建了一个 simple/blank 片段,它应该使用 Mosby 框架。每次我使用 getView() 方法时,我都会收到错误消息:

java.lang.ClassCastException: de.xxx.projectZ.packA.AFragment cannot be cast to de.xxx.projectZ.packA.AView

public interface AView extends MvpLceView<List<Persons>> {
  // empty
}

导致错误的我的演示者

public class APresenter extends MvpBasePresenter<AView> {
    PersonsRepository personsRepository;

    @Inject
    public APresenter(PersonsRepositoryImpl personsRepository) {
        this.personsRepository = personsRepository;
    }

    public void loadPersons() {
// ERROR
        if (isViewAttached())
            getView().showLoading(true);

        List<Person> persons = personsRepository.getPersons();


        if (isViewAttached()) {

        }
    }
}

我的片段header

public class PersonsFragment
        extends MvpLceFragment<SwipeRefreshLayout, List<Person>, AView, APresenter> {

有人知道为什么会这样吗?

您的 Fragment 未实现 AView ...

public class PersonsFragment
        extends MvpLceFragment<SwipeRefreshLayout, List<Person>, AView, APresenter> 

        implements AView  // This is missing
{
 ...
}