问题描述
- 一个空指针异常问题,求大神帮忙解决下,在线等
-
public void getQaList(String type, String qid, String qid_min, String cat_id, String tag_id, String page, String qid_top, boolean isShowLoadingDialog) { List<RequestParameter> parameter = new ArrayList<RequestParameter>(); parameter.add(new RequestParameter("type", type)); parameter.add(new RequestParameter("qid", qid)); parameter.add(new RequestParameter("qid_min", qid_min)); parameter.add(new RequestParameter("cat_id", cat_id)); parameter.add(new RequestParameter("tag_id", tag_id)); parameter.add(new RequestParameter("page", page)); parameter.add(new RequestParameter("qid_top", qid_top));
(空指针异常)
startHttpRequest(Constants.HTTP_POST, Constants.QA_LIST_Q_1_4, parameter, isShowLoadingDialog, Constants.LOADING_CONTENTS, true, Constants.CONNECTION_SHORT_TIMEOUT, Constants.READ_MIDDLE_TIMEOUT, LOAD_QUESTION_KEY); }
跳转到
protected void startHttpRequst(String requestType, String url,
List parameter, boolean isShowLoadingDialog,
String loadingDialogContent, boolean isHideCloseBtn,
int connectTimeout, int readTimeout) {
startHttpRequest(requestType, url, parameter, isShowLoadingDialog,
loadingDialogContent, isHideCloseBtn, connectTimeout,
readTimeout, -1);
}protected void startHttpRequest(String requestType, String url, List<RequestParameter> parameter, boolean isShowLoadingDialog, String loadingDialogContent, boolean isHideCloseBtn, int connectTimeout, int readTimeout, int resultCode) { startHttpRequest(null, requestType, url, parameter, isShowLoadingDialog, loadingDialogContent, isHideCloseBtn, connectTimeout, readTimeout, resultCode); } protected void startHttpRequest(File file, String requestType, String url, List<RequestParameter> parameter, boolean isShowLoadingDialog, String loadingDialogContent, boolean isHideCloseBtn, int connectTimeout, int readTimeout, int resultCode) { if (isShowLoadingDialog) { if (!CheckNetWorkUtil.netWorkIsAvailable(getActivity())) { return; } } if (null != parameter) { FragmentActivity activity = getActivity(); if (activity != null) { parameter.add(new RequestParameter("appver", DeviceUtil .getVersionName(activity))); parameter.add(new RequestParameter("ver", DeviceUtil .getVersionName(getActivity()))); } parameter.add(new RequestParameter("width", MyApplication.screenWidth)); parameter.add(new RequestParameter("height", MyApplication.screenHeight)); parameter.add(new RequestParameter("device", Constants.DEVICE)); parameter.add(new RequestParameter("devname", MyApplication.manufacturer)); parameter.add(new RequestParameter("sysver", MyApplication.sysver)); parameter.add(new RequestParameter("system", Constants.DEVICE)); parameter.add(new RequestParameter("source", Constants.DEVICE)); parameter.add(new RequestParameter("imei", Constants.HWID)); } LogUtil.d("requestUrl", url); for (int i = 0; i < parameter.size(); i++) { RequestParameter requestParameter = parameter.get(i);
// LogUtil.d("requestParameter", requestParameter.getName() + "="
// + requestParameter.getValue());
}
BaseRequest httpRequest = null;
if ("POST".equalsIgnoreCase(requestType)) {
httpRequest = new AsyncHttpPost(file, getActivity(), this, url,
parameter, isShowLoadingDialog, loadingDialogContent,
isHideCloseBtn, connectTimeout, readTimeout, resultCode);
} else {
httpRequest = new AsyncHttpGet(getActivity(), this, url, parameter,
isShowLoadingDialog, loadingDialogContent, isHideCloseBtn,
connectTimeout, readTimeout, resultCode);
}
DefaultThreadPool.getInstance().execute(httpRequest);this.requestList.add(httpRequest);
}
解决方案
求大神帮忙解决一个网络设备互联的考试题,谢谢啦。
急求大神帮忙解决的问题
解决方案二:
是不是PagerAdapter