@Override public Integer doInBackground(Void... params) { try { HttpResponse response; String urlForDashboards = AccountSetting.getInstance().getDomainName() + ExoConstants.DASHBOARD_PATH; /* * Checking the session status each time we retrieve dashboard item list. * If time out, re logging in */ if (ExoConnectionUtils.checkTimeout(urlForDashboards) != ExoConnectionUtils.LOGIN_SUCCESS) return RESULT_TIMEOUT; items.clear(); response = ExoConnectionUtils.getRequestResponse(urlForDashboards); dashboardList = dashboardController.getDashboards(response); for (int i = 0; i < dashboardList.size(); i++) { DashboardItem gadgetTab = dashboardList.get(i); try { HttpResponse response2 = ExoConnectionUtils.getRequestResponse(gadgetTab.link); List<GadgetInfo> gadgets = dashboardController.getGadgetInTab(response2, gadgetTab.label, gadgetTab.link); if (gadgets != null && gadgets.size() > 0) { items.add(new GadgetInfo(gadgetTab.label)); items.addAll(gadgets); } } catch (IOException e) { Log.e("DashboardLoadTask", e.getMessage()); } } return RESULT_OK; } catch (IOException e) { if (Log.LOGD) Log.d(getClass().getSimpleName(), e.getMessage(), Log.getStackTraceString(e)); return RESULT_ERROR; } }