本文整理汇总了Java中android.support.v4.app.LoaderManager.destroyLoader方法的典型用法代码示例。如果您正苦于以下问题:Java LoaderManager.destroyLoader方法的具体用法?Java LoaderManager.destroyLoader怎么用?Java LoaderManager.destroyLoader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.app.LoaderManager
的用法示例。
在下文中一共展示了LoaderManager.destroyLoader方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: search
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void search(EditText editText) {
mEditText = editText;
// Initialize the Loader with id '1239' and callbacks.
// If the loader doesn't already exist, one is created. Otherwise,
// the already created Loader is reused. In either case, the
// LoaderManager will manage the Loader across the Activity/Fragment
// lifecycle, will receive any new loads once they have completed,
// and will report this new data back via callbacks.
LoaderManager lm = getSupportLoaderManager();
//close any loader that is already running
lm.destroyLoader(LOADER_ID);
//init new loader
lm.initLoader(LOADER_ID, null, this);
}
示例2: removeLayer
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
public boolean removeLayer(Layer layer) {
final LoaderManager lm = getLoaderManager();
final int loaderId = layer.getLoaderId();
if (loaderId != -1) {
lm.destroyLoader(loaderId);
layer.setLoaderId(-1);
}
return mLayers.remove(layer);
}
示例3: onUpdateGuid
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
void onUpdateGuid(@Nullable final String guid) {
final boolean changed = !TextUtils.equals(guid, mGuid);
// cleanup after previous user if active user is changing
if (changed) {
// destroy current loaders
final LoaderManager manager = getSupportLoaderManager();
manager.destroyLoader(LOADER_CURRENT_ASSIGNMENT);
}
// update active user
mGuid = guid;
if(changed) {
// update no assignments receiver
updateNoAssignmentsBroadcastReceiver();
}
// show login dialog if there isn't a valid active user
if (mGuid == null) {
showLogin();
}
// otherwise start processes for current active user
else if (changed) {
syncData(false);
startLoaders();
loadMap(mGuid);
}
}
示例4: onSharedPreferenceChanged
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
if (key.equals(GutenbergApplication.PREF_EVENT_ID)) {
LoaderManager manager = getLoaderManager();
Bundle args = new Bundle();
args.putString(ARG_EVENT_ID, prefs.getString(key, null));
manager.destroyLoader(LOADER_ATTENDEES);
manager.initLoader(LOADER_ATTENDEES, args, this);
manager.destroyLoader(LOADER_EVENT);
manager.initLoader(LOADER_EVENT, args, this);
}
}
示例5: onSharedPreferenceChanged
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
if (key.equals(GutenbergApplication.PREF_EVENT_ID)) {
Bundle args = new Bundle(getArguments());
args.putString(ARG_EVENT_ID, prefs.getString(key, null));
LoaderManager manager = getLoaderManager();
manager.destroyLoader(LOADER_ATTENDEES);
manager.initLoader(LOADER_ATTENDEES, args, this);
}
}
示例6: onLoadCurrentAssignment
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
/**
* This event is triggered when a fresh assignment object is loaded
*
* @param assignment the new assignment object
*/
void onLoadCurrentAssignment(@Nullable final Assignment assignment) {
final Assignment old = mAssignment;
final Ministry oldMinistry = mMinistry;
mAssignment = assignment;
mMinistry = mAssignment != null ? mAssignment.getMinistry() : null;
// determine what has changed
final String oldId;
final Mcc oldMcc;
final String newId;
final Mcc newMcc;
if (old != null) {
oldId = old.getMinistryId();
oldMcc = old.getMcc();
} else {
oldId = Ministry.INVALID_ID;
oldMcc = Mcc.UNKNOWN;
}
if (mAssignment != null) {
newId = mAssignment.getMinistryId();
newMcc = mAssignment.getMcc();
} else {
newId = Ministry.INVALID_ID;
newMcc = Mcc.UNKNOWN;
}
final LatLng oldLocation;
final int oldZoom;
final LatLng newLocation;
final int newZoom;
if (oldMinistry != null) {
oldLocation = ModelUtils.getLocation(oldMinistry);
oldZoom = oldMinistry.getLocationZoom();
} else {
oldLocation = null;
oldZoom = 0;
}
if (mMinistry != null) {
newLocation = ModelUtils.getLocation(mMinistry);
newZoom = mMinistry.getLocationZoom();
} else {
newLocation = null;
newZoom = 0;
}
final boolean changed = !oldId.equals(newId);
final boolean changedMcc = changed || oldMcc != newMcc;
final boolean changedLocation = changed || !Objects.equal(oldLocation, newLocation) || oldZoom != newZoom;
// sync updated data
if (changed || changedMcc) {
syncData(false);
}
// restart loaders if necessary
if (changed || changedMcc) {
// destroy old loaders
final LoaderManager manager = getLoaderManager();
manager.destroyLoader(LOADER_TRAININGS);
manager.destroyLoader(LOADER_CHURCHES);
// start loaders for current assignment
startLoaders(mAssignment);
}
// update views
updateViews();
// update map location when changing ministries
if (changedLocation) {
updateMapLocation();
}
}
示例7: destroyLoader
import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
protected final void destroyLoader(final int loaderId) {
LoaderManager lm = operatorContext.loaderManager;
lm.destroyLoader(loaderId);
}