Merge "Adding a stopLoading() method."
This commit is contained in:
committed by
Android (Google) Code Review
commit
81d5dad156
@@ -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"
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user