@Override protected void onPostExecute(Object result) { super.onPostExecute(result); if (res != null) { if ("00".equals(res.getResponseStatus().getCode())) { // Success if (res != null && res.getProjects() != null && res.getProjects().size() > 0) { if (lvContent.getAdapter() == null) { adapter = new MyFreeAdapter(lstInvestments); lvContent.setAdapter(adapter); } else { adapter.setLstMyFree(lstInvestments); } Utils.setListItemCheck(lvContent, lineCount - 1); } } else { // 服务器异常 Toast.makeText( FinanceStocksApp.getContext(), res.getResponseStatus().getMessage(), Toast.LENGTH_SHORT) .show(); } } else { Toast.makeText( FinanceStocksApp.getContext(), R.string.network_exception, Toast.LENGTH_SHORT) .show(); } mRefreshListView.onRefreshComplete(); }
@Override protected void onPostExecute(Object result) { super.onPostExecute(result); if (res != null) { if (AppConstants.RESPONSE_SUCCESS.equals(res.getResponseStatus().getCode())) { // Success if (lvContent.getAdapter() == null) { adapter = new MyFreeAdapter(lstInvestments); lvContent.setAdapter(adapter); } else { adapter.setLstMyFree(lstInvestments); } } else if (!AppConstants.ERROR_TOKEN.equals(res.getResponseStatus().getCode())) { // 服务器异常 Toast.makeText( FinanceStocksApp.getContext(), res.getResponseStatus().getMessage(), Toast.LENGTH_SHORT) .show(); } } else { Toast.makeText( FinanceStocksApp.getContext(), R.string.network_exception, Toast.LENGTH_SHORT) .show(); } mRefreshListView.onRefreshComplete(); }
@Override protected Object doInBackground(Object... params) { lineCount = lstInvestments.size(); List<FinancingProjectVo> lstInvestOrders = new ArrayList<FinancingProjectVo>(); res = queryInvestments(lineCount, null); L.d(TAG, "[My Investments]: " + new Gson().toJson(res)); if (res != null && res.getProjects() != null && res.getProjects().size() > 0) { lstInvestOrders.addAll(res.getProjects()); if (lstInvestOrders != null) { for (FinancingProjectVo investOrder : lstInvestOrders) { // 遍历排除已存在的项目 if (lstInvestments.contains(investOrder)) { lstInvestments.remove(investOrder); } } } lstInvestments.addAll(lstInvestOrders); Collections.sort(lstInvestments); } return super.doInBackground(params); }