Merge "Adding a stopLoading() method."

This commit is contained in:
Dmitri Plotnikov
2010-06-09 20:22:03 -07:00
committed by Android (Google) Code Review
2 changed files with 30 additions and 1 deletions

View File

@@ -27930,6 +27930,19 @@
<parameter name="args" type="android.os.Bundle">
</parameter>
</method>
<method name="stopLoading"
return="void"
abstract="false"
native="false"
synchronized="false"
static="false"
final="false"
deprecated="not deprecated"
visibility="public"
>
<parameter name="id" type="int">
</parameter>
</method>
</class>
<class name="LocalActivityManager"
extends="java.lang.Object"

View File

@@ -174,7 +174,23 @@ public abstract class LoaderManagingFragment<D> extends Fragment
}
}
/**
/**
* Stops and removes the loader with the given ID.
*/
public void stopLoading(int id) {
if (mLoaders != null) {
LoaderInfo<D> info = mLoaders.remove(id);
if (info != null) {
Loader<D> 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.
*/