當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。