I just create a simple/blank fragment, which should use the Mosby
Framework. Every time I'm using the getView()
method I'm getting the error:
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
}
My presenter which cause the error
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()) {
}
}
}
My fragment header
public class PersonsFragment
extends MvpLceFragment<SwipeRefreshLayout, List<Person>, AView, APresenter> {
Does anybody know why this happen?
your Fragment is not implementing AView
...
public class PersonsFragment
extends MvpLceFragment<SwipeRefreshLayout, List<Person>, AView, APresenter>
implements AView // This is missing
{
...
}