How to make callback from AsyncTask to fragment Activity?
<p>I have requests to web service implemented using AsyncTask. Normally callback to Activity i do using interface:</p>

<pre><code>public interface AsyncTaskComplete&lt;T&gt; {

    public void onTaskComplete(T result);
    public void onTaskFailed(T result);

}
</code></pre>

<p>In AsyncTask:</p>

<pre><code>private AsyncTaskComplete&lt;String&gt; callback;

public AsyncTaskAbout(AsyncTaskComplete&lt;String&gt; cb) {
    this.callback = cb;
}

protected void onPostExecute(String result) {
    if(result ==  null){
        callback.onTaskFailed(result);
    }else{
        callback.onTaskComplete(result);
    }

}
</code></pre>

<p>But if i want to give callback FragmentActivity compiler suggest me to change AsyncTask constructor to:</p>

<pre><code>public AsyncTaskAbout(FragmentActivity faActivity) {
    this.callback = (AsyncTaskComplete&lt;String&gt;) faActivity;
}
</code></pre>

<p>Where is warning:</p>

<pre><code>Type safety: Unchecked cast from FragmentActivity to AsyncTaskComplete&lt;String&gt;
</code></pre>

<p>So what i need to change ?</p>

<p>Or how to make callback in this case ?</p>

<p>Thanks.</p>
