private void selectAll() { final DownloadIndexAdapter listAdapter = (DownloadIndexAdapter) getExpandableListAdapter(); int selected = 0; for (int j = 0; j < listAdapter.getGroupCount(); j++) { for (int i = 0; i < listAdapter.getChildrenCount(j); i++) { IndexItem es = listAdapter.getChild(j, i); if (!getEntriesToDownload().containsKey(es)) { selected++; getEntriesToDownload() .put( es, es.createDownloadEntry( getClientContext(), type, new ArrayList<DownloadEntry>(1))); } } } AccessibleToast.makeText( this, MessageFormat.format(getString(R.string.items_were_selected), selected), Toast.LENGTH_SHORT) .show(); listAdapter.notifyDataSetInvalidated(); if (selected > 0) { updateDownloadButton(true); } }