2016-09-16 1 views
2

単純な空白のフラグメントを作成します。このフラグメントは、Mosbyフレームワークを使用する必要があります。エラーMosby Framework - getViewの原因ClassCastException

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()) { 

     } 
    } 
} 

マイフラグメントヘッダ

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

がい引き起こし

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 
} 

マイプレゼンター:私は、私はエラーを取得していますgetView()方法を使用していますたびに誰がなぜこれが起こるのか知っていますか?あなたのフラグメントがAViewを実装していない

答えて

2

...

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

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

くそ...ありがとう.. :) – Tobias

関連する問題