当前位置: 首页>>代码示例>>Java>>正文


Java LoaderManager.getLoader方法代码示例

本文整理汇总了Java中android.app.LoaderManager.getLoader方法的典型用法代码示例。如果您正苦于以下问题:Java LoaderManager.getLoader方法的具体用法?Java LoaderManager.getLoader怎么用?Java LoaderManager.getLoader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.app.LoaderManager的用法示例。


在下文中一共展示了LoaderManager.getLoader方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onChange

import android.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onChange(boolean selfChange) {
    if (!isAdded()) {
        return;
    }

    //clear map reload all data
    clearMap();
    setupMap(false);

    // reload data from loaders
    LoaderManager lm = getActivity().getLoaderManager();

    Loader<Cursor> loader =
            lm.getLoader(TOKEN_LOADER_MARKERS);
    if (loader != null) {
        loader.forceLoad();
    }

    loader = lm.getLoader(TOKEN_LOADER_TILES);
    if (loader != null) {
        loader.forceLoad();
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:25,代码来源:MapFragment.java

示例2: onChange

import android.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onChange(boolean selfChange) {
    if (!isAdded()) {
        return;
    }

    //clear map reload all data
    clearMap();
    setupMap(false);

    // reload data from loaders
    LoaderManager lm = getActivity().getLoaderManager();
    mMarkersLoaded = false;
    mOverlaysLoaded = false;

    Loader<Cursor> loader =
            lm.getLoader(MarkerQuery._TOKEN);
    if (loader != null) {
        loader.forceLoad();
    }

    loader = lm.getLoader(OverlayQuery._TOKEN);
    if (loader != null) {
        loader.forceLoad();
    }
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:27,代码来源:MapFragment.java

示例3: onChange

import android.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onChange(boolean selfChange) {
    if (!isAdded()) {
        return;
    }

    //Reload data
    LoaderManager lm = getLoaderManager();
    Loader<Cursor> loader = lm.getLoader(0);
    if (loader != null) {
        loader.forceLoad();
    }
}
 
开发者ID:kevinshine,项目名称:BeyondUPnP,代码行数:14,代码来源:PlaylistFragment.java

示例4: onStart

import android.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onStart() {
	super.onStart();
	db = StaticDataStore.getInstance(getActivity());
	Logging.Log(LOG_TAG,"Setting prefs.");
	numResultsPref = Integer.valueOf(db.getPref("numResults"));
	sortPref = db.getPref("sortOrder");
	
	
	if(this.getArguments().containsKey("Artist")){
		String artist = this.getArguments().getString("Artist");
		if(artist!=null){
			this.browseArtist(artist);
			this.getArguments().remove("Artist");
		}
}
	// Must call in order to get callback to onOptionsItemSelected()
	setHasOptionsMenu(true);
       getActivity().getActionBar().setDisplayHomeAsUpEnabled(true);
       getActivity().getActionBar().setTitle("Search");
	LoaderManager lm = this.getLoaderManager();
	if(lm.getLoader(0)!=null){
		// The second argument is the query for a new loader, but here we are trying to
		// reconnect to an already existing loader, and "If a loader already exists
		// (a new one does not need to be created), this parameter will be ignored and
		// the last arguments continue to be used.If a loader already exists (a new one
		// does not need to be created), this parameter will be ignored and the last arguments
		// continue to be used.
		// http://developer.android.com/reference/android/app/LoaderManager.html
		lm.initLoader(0, null, this);
	}
}
 
开发者ID:sedenardi,项目名称:vibevault,代码行数:33,代码来源:SearchFragment.java

示例5: executeSearch

import android.app.LoaderManager; //导入方法依赖的package包/类
private void executeSearch(String query) {
	dateChanged = false;
	Bundle b = new Bundle();
	b.putString("query", query);
	LoaderManager lm = this.getLoaderManager();
	if(lm.getLoader(0)!=null){
		// We already have a loader.
		Logging.Log(LOG_TAG, "RESTART.");
		lm.restartLoader(0, b, this);
	} else{
		// We need a new loader.
		lm.initLoader(0, b, this);
	}
}
 
开发者ID:sedenardi,项目名称:vibevault,代码行数:15,代码来源:SearchFragment.java

示例6: initOrRestartLoader

import android.app.LoaderManager; //导入方法依赖的package包/类
public static void initOrRestartLoader(LoaderManager loaderManager, int id, Bundle bundle, LoaderManager.LoaderCallbacks callbacks) {
    Loader loader = loaderManager.getLoader(id);
    if (loader == null) {
        loaderManager.initLoader(id, bundle, callbacks);
    } else {
        loaderManager.restartLoader(id, bundle, callbacks);
    }

}
 
开发者ID:AAverin,项目名称:android-skeleton-project,代码行数:10,代码来源:Utils.java

示例7: onItemSelected

import android.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
	mBox = (Integer) parent.getItemAtPosition(position);
	// init or restart async word loader
	LoaderManager loaderManager = getLoaderManager();
	if (loaderManager.getLoader( LOADER_ID) == null) {
		loaderManager.initLoader( LOADER_ID, null, this);
	} else {
		loaderManager.restartLoader(LOADER_ID, null, this);
	}
}
 
开发者ID:pecheur,项目名称:android-woodenbox,代码行数:12,代码来源:CardActivity.java

示例8: refreshData

import android.app.LoaderManager; //导入方法依赖的package包/类
private void refreshData() {
	displaySpinningWheelWhileLoading();
	dbAdapter.notifyDataSetChanged();
	getListView().invalidateViews();
	
	LoaderManager lm = getLoaderManager();
	if (lm.getLoader(LOADER_ID) != null) {        	
		lm.restartLoader(LOADER_ID, null, this);
	} else {
		lm.initLoader(LOADER_ID, null, this);        	
	}
}
 
开发者ID:UNICEF-Youth-Section,项目名称:unicef_gis_mobile,代码行数:13,代码来源:MyReportsActivity.java

示例9: startLoader

import android.app.LoaderManager; //导入方法依赖的package包/类
/**
 * Starts a loader with the specified <var>id</var>. If there was already started loader with the
 * same id before, such a loader will be <b>re-started</b>, otherwise new loader will be <b>initialized</b>.
 *
 * @param id        Id of the desired loader to start.
 * @param params    Params for loader.
 * @param callbacks Callbacks for loader.
 * @return Initialized or re-started loader instance or {@code null} if the specified <var>callbacks</var>
 * do not create loader for the specified <var>id</var>.
 * @see #initLoader(int, Bundle, LoaderManager.LoaderCallbacks)
 * @see #restartLoader(int, Bundle, LoaderManager.LoaderCallbacks)
 * @see #destroyLoader(int)
 */
@Nullable
public <D> Loader<D> startLoader(@IntRange(from = 0) final int id, @Nullable final Bundle params, @NonNull final LoaderManager.LoaderCallbacks<D> callbacks) {
	final LoaderManager manager = getLoaderManager();
	return manager.getLoader(id) == null ?
			initLoader(id, params, callbacks) :
			restartLoader(id, params, callbacks);
}
 
开发者ID:universum-studios,项目名称:android_fragments,代码行数:21,代码来源:BaseFragment.java


注:本文中的android.app.LoaderManager.getLoader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。