/** reloadStores and clean Contextual Action Bar if present */ public void reloadStores() { Log.v("SOURCES", "reloading sources"); Loader l = getSherlockActivity().getSupportLoaderManager().getLoader(LOADER_INDEX); if (l != null) { adapter.clear(); l.forceLoad(); } if (actionMode != null) { actionMode.finish(); selected = new ArrayList<LayerStore>(); getListView().clearChoices(); getListView().clearFocus(); } }
/* (non-Javadoc) * @see android.support.v4.app.LoaderManager.LoaderCallbacks#onLoadFinished(android.support.v4.content.Loader, java.lang.Object) */ @Override public void onLoadFinished(Loader<List<LayerStore>> loader, List<LayerStore> result) { adapter.clear(); ArrayList<LayerStore> ll = new ArrayList<LayerStore>(); int size = result.size(); Log.v("SOURCES", "Loaded sources:" + size); if (size > 0) { for (LayerStore ls : result) { adapter.add(ls); } } adapter.notifyDataSetChanged(); }
/* (non-Javadoc) * @see android.support.v4.app.LoaderManager.LoaderCallbacks#onLoaderReset(android.support.v4.content.Loader) */ @Override public void onLoaderReset(Loader<List<LayerStore>> arg0) { adapter.clear(); }