From d92ea071c0d8161f63c3a6a3cb4875adf9a3b226 Mon Sep 17 00:00:00 2001 From: Dmitri Plotnikov Date: Wed, 9 Jun 2010 20:20:38 -0700 Subject: [PATCH] Adding a stopLoading() method. This add an API to stop and remove a loader that is no longer needed. Change-Id: Ibe59981bb8bc9965a3360917e80b0e710efcd8e1 --- api/current.xml | 13 +++++++++++++ .../android/app/LoaderManagingFragment.java | 18 +++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/api/current.xml b/api/current.xml index 655767442f75e..c7e0e5807ad77 100644 --- a/api/current.xml +++ b/api/current.xml @@ -27930,6 +27930,19 @@ + + + + extends Fragment } } - /** + /** + * Stops and removes the loader with the given ID. + */ + public void stopLoading(int id) { + if (mLoaders != null) { + LoaderInfo info = mLoaders.remove(id); + if (info != null) { + Loader loader = info.loader; + if (loader != null) { + loader.unregisterListener(this); + loader.destroy(); + } + } + } + } + + /** * @return the Loader with the given id or null if no matching Loader * is found. */