// segment is used to update segment list public void setCurrLinkCount(LinkFilter linkCount, Segment segment) { // try not to update too often if (!linkCount.equals(currLinkCount)) { currLinkCount = linkCount; if (segment != null) // o/w no need to update itemList. You probably just initialized LinkTextAdapter try { setItemList(Link.getLinkedTexts(segment, currLinkCount)); } catch (API.APIException e) { setItemList(new ArrayList<Segment>()); API.makeAPIErrorToast(activity); } catch (Exception e) { setItemList(new ArrayList<Segment>()); try { Toast.makeText( activity, MyApp.getRString(R.string.error_getting_links), Toast.LENGTH_SHORT) .show(); } catch (Exception e1) { e1.printStackTrace(); } } } }