我重写了一个MyAsyntask在别的activity里面可以成功,在fragment里面怎么都不执行,无论是onSuccess 还是onFailure都不执行,,,求助啊
下面是代码段
RequestParams params = new RequestParams();
params.put("viewStaffFileId.staffId", staffId + "");
MyAsyncHttpClient.post(urlStr, params, new AsyncHttpResponseHandler() {
@Override
public void onFailure(Throwable error) {
// TODO Auto-generated method stub
super.onFailure(error);
Toast.makeText(getActivity(), "失败", Toast.LENGTH_SHORT).show();
}
@Override
public void onSuccess(String content) {
// TODO Auto-generated method stub
list = GsonUtil.getStaffFileListFromJson(content);
Toast.makeText(getActivity(), “成功”, Toast.LENGTH_SHORT).show();
c
}
});
本人菜鸟一枚,但还是想说一声:Asyntask貌似只能在主线程执行,你说它不执行,就先认真看一看你是否有把它放在主线程中。
谢啦
我傻逼了 服务端写错了