我正在從我的Fragment類調用AsyncTask,當我嘗試將數據發送回我的Fragment時,出現空指針異常。我的監聽器中的空指針異常
public interface AsyncListner {
public void onLoadComplete(List<DocumentResponse> documents);
}
My Fragment類實現了接口。
public class FragmentClass extends SherlockFragment implements AsyncListner {@
Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
new AsyncTask(Obj, getSherlockActivity()).setListener(this);
new AsyncTask(Obj, getSherlockActivity()).execute();
}
@Override
public void onLoadComplete(List < Response> data) {
Log.d("Result", data.toString());
}
}
我跟着這個答案。 https://stackoverflow.com/a/13476196/98514
我已經更新了我的構造函數... – Kevin