2016-06-26 1 views
1
Android Studio 2.1.2 

私はこの警告を受けており、なぜそれが見つからないのでしょうか。私は生の種類を使用していません。生のタイプのメンバへの未確認コール

Unchecked call to attachView(DownloadViewContract) as a member of raw type 

私はこれは私の見解ためのインタフェース

public interface DownloadViewContract { 
    void onSuccessDownload(); 
    void onFailureDownload(String errMsg); 
} 

そして、私のフラグメントである次のインターフェイスに

public interface DownloadPresenterContract { 
    interface Operations<DownloadViewContract> { 
     void attachView(DownloadViewContract view); 
     void detachView(); 
     void getData(); 
    } 
} 

そして、次の実装

public class DownloadPresenterImp implements 
     DownloadPresenterContract.Operations<DownloadViewContract> { 

    private DownloadViewContract mView; 

    private DownloadPresenterImp() { 
    } 

    public static DownloadPresenterImp getNewInstance() { 
     return new DownloadPresenterImp(); 
    } 

    /* Operations */ 
    @Override 
    public void attachView(DownloadViewContract view) { 
     mView = view; 
    } 
} 

を持っています私の意見

public class DownloadView extends Fragment implements DownloadViewContract { 
    @Override 
    public void onActivityCreated(Bundle savedInstanceState) { 
     mDownloadPresenterContract = DownloadPresenterImp.getNewInstance(); 

     /* UNCHECKED MEMBER TO RAW TYPE */ 
     mDownloadPresenterContract.attachView(DownloadView.this); 
    } 
    ..... 
} 

私は明示的に私のプレゼンターインターフェイスタイプとしてDownloadViewContractを命名していますように私は警告を取得していますなぜ私は理解していません。私の見解ではDownloadViewContractインターフェイスを実装しているので、何か問題があるとは思わない。

任意の提案のための多くのおかげで、

+0

あなたは 'mDownloadPresenterContract'の宣言を表示することができますか? – manouti

+0

DownloadPresenterContractは既に私の質問にあります。パブリックインターフェイスDownloadPresenterContract { インターフェイス操作 { void attachView(DownloadViewContract view); void detachView(); void getData(); } } – ant2009

答えて

2

私が代わりにこのようにそれを宣言し、あなたはタイプを指定せずにmDownloadPresenterContractを宣言すると信じて:

DownloadPresenterContract.Operations<DownloadViewContract> mDownloadPresenterContract = DownloadPresenterImp.getNewInstance(); 

mDownloadPresenterContract.attachView(DownloadView.this); 
+0

ありがとう、私はそれを逃したか分からない。 – ant2009

関連する問題