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


Java LoaderManager.initLoader方法代码示例

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


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

示例1: loadListViewItems

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(int listPosition, boolean markSeen, boolean showProgress) {
    if (!isAdded()) {
        return;
    }
    int loaderId = 0;
    ConversationsLoaderCallbacks callbacks =
            new ConversationsLoaderCallbacks(getContext(), listView,
                    listPosition, cursorAdapter, markSeen, showProgress);

    LoaderManager manager = getLoaderManager();
    Loader<?> loader = manager.getLoader(loaderId);
    if (loader == null) {
        // init and run the items loader
        manager.initLoader(loaderId, null, callbacks);
    } else {
        // restart loader
        manager.restartLoader(loaderId, null, callbacks);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:20,代码来源:SMSConversationsListFragment.java

示例2: loadListViewItems

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(String itemsFilter, boolean deleteItems, int listPosition) {
    if (!isAdded()) {
        return;
    }
    int loaderId = 0;
    JournalItemsLoaderCallbacks callbacks =
            new JournalItemsLoaderCallbacks(getContext(), cursorAdapter,
                    itemsFilter, deleteItems, listView, listPosition);
    LoaderManager manager = getLoaderManager();
    if (manager.getLoader(loaderId) == null) {
        // init and run the items loader
        manager.initLoader(loaderId, null, callbacks);
    } else {
        // restart loader
        manager.restartLoader(loaderId, null, callbacks);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:18,代码来源:JournalFragment.java

示例3: loadListViewItems

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(int threadId, int unreadCount, int listPosition) {
    if (!isAdded()) {
        return;
    }
    int loaderId = 0;
    ConversationLoaderCallbacks callbacks =
            new ConversationLoaderCallbacks(getContext(),
                    threadId, unreadCount, listView, listPosition, cursorAdapter);

    LoaderManager manager = getLoaderManager();
    if (manager.getLoader(loaderId) == null) {
        // init and run the items loader
        manager.initLoader(loaderId, null, callbacks);
    } else {
        // restart loader
        manager.restartLoader(loaderId, null, callbacks);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:19,代码来源:SMSConversationFragment.java

示例4: loadListViewItems

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(String itemsFilter, boolean deleteItems, int listPosition) {
    if (!isAdded()) {
        return;
    }
    int loaderId = 0;
    ContactsLoaderCallbacks callbacks =
            new ContactsLoaderCallbacks(getContext(), contactType, cursorAdapter,
                    itemsFilter, deleteItems, listView, listPosition);
    LoaderManager manager = getLoaderManager();
    if (manager.getLoader(loaderId) == null) {
        // init and run the items loader
        manager.initLoader(loaderId, null, callbacks);
    } else {
        // restart loader
        manager.restartLoader(loaderId, null, callbacks);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:18,代码来源:ContactsFragment.java

示例5: 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);
}
 
开发者ID:kevalpatel2106,项目名称:android-samples,代码行数:17,代码来源:MainActivity.java

示例6: onActivityCreated

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
	super.onActivityCreated(savedInstanceState);

	Activity activity = getActivity();
	if (activity instanceof FloatingActionButtonProvider) {
		actionButton = ((FloatingActionButtonProvider) activity).getActionButton();
		if (actionButton != null) {
			actionButton.setOnClickListener(actionButtonClickListener);
		}
	}

	// Ensure the actionButton is initialized before creating the options menu
	setHasOptionsMenu(true);

	LoaderManager loaderManager = getLoaderManager();
	loaderManager.initLoader(BOOKMARK_STATUS_LOADER_ID, null, bookmarkStatusLoaderCallbacks);
	loaderManager.initLoader(EVENT_DETAILS_LOADER_ID, null, eventDetailsLoaderCallbacks);
}
 
开发者ID:sysdharma,项目名称:py-eventos-android,代码行数:20,代码来源:EventDetailsFragment.java

示例7: startSearch

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void startSearch(String terms, String tags, int page){
	noResults.setVisibility(View.GONE);
	Bundle args = new Bundle();
	args.putString(SearchActivity.TERMS, terms);
	args.putString(SearchActivity.TAGS, tags);
	args.putInt(SearchActivity.PAGE, page);
	LoaderManager lm = getLoaderManager();
	Loader l = lm.getLoader(page);
	if (l == null){
		lm.initLoader(page, args, this);
	}
	//Check if the terms and tags are different from what the loader has and restart if they're different
	else {
		RequestSearchAsyncLoader s = (RequestSearchAsyncLoader)l;
		if (!s.getTerms().equalsIgnoreCase(searchTerms) || !s.getTags().equalsIgnoreCase(tags)){
			lm.restartLoader(page, args, this);
		}
		else {
			lm.initLoader(page, args, this);
		}
	}
}
 
开发者ID:stuxo,项目名称:PTHAndroid,代码行数:23,代码来源:RequestSearchFragment.java

示例8: startSearch

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void startSearch(String terms, int page){
	noResults.setVisibility(View.GONE);
	Bundle args = new Bundle();
	args.putString(SearchActivity.TERMS, terms);
	args.putInt(SearchActivity.PAGE, page);
	LoaderManager lm = getLoaderManager();
	Loader l = lm.getLoader(page);
	if (l == null){
		lm.initLoader(page, args, this);
	}
	//Check if the terms and tags are different from what the loader has and restart if they're different
	else {
		UserSearchAsyncLoader s = (UserSearchAsyncLoader)l;
		if (!s.getTerms().equalsIgnoreCase(searchTerms)){
			lm.restartLoader(page, args, this);
		}
		else {
			lm.initLoader(page, args, this);
		}
	}
}
 
开发者ID:stuxo,项目名称:PTHAndroid,代码行数:22,代码来源:UserSearchFragment.java

示例9: startSearch

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void startSearch(String terms, String tags, int page){
	noResults.setVisibility(View.GONE);
	Bundle args = new Bundle();
	args.putString(SearchActivity.TERMS, terms);
	args.putString(SearchActivity.TAGS, tags);
	args.putInt(SearchActivity.PAGE, page);
	LoaderManager lm = getLoaderManager();
	Loader l = lm.getLoader(page);
	if (l == null){
		lm.initLoader(page, args, this);
	}
	//Check if the terms and tags are different from what the loader has and restart if they're different
	else {
		TorrentSearchAsyncLoader s = (TorrentSearchAsyncLoader)l;
		if (!s.getTerms().equalsIgnoreCase(searchTerms) || !s.getTags().equalsIgnoreCase(tags)){
			lm.restartLoader(page, args, this);
		}
		else {
			lm.initLoader(page, args, this);
		}
	}
}
 
开发者ID:stuxo,项目名称:PTHAndroid,代码行数:23,代码来源:TorrentSearchFragment.java

示例10: onActivityCreated

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    Activity activity = getActivity();
    if (activity instanceof FloatingActionButtonProvider) {
        actionButton = ((FloatingActionButtonProvider) activity).getActionButton();
        if (actionButton != null) {
            actionButton.setOnClickListener(actionButtonClickListener);
        }
    }

    // Ensure the actionButton is initialized before creating the options menu
    setHasOptionsMenu(true);

    LoaderManager loaderManager = getLoaderManager();
    loaderManager.initLoader(BOOKMARK_STATUS_LOADER_ID, null, bookmarkStatusLoaderCallbacks);
    loaderManager.initLoader(EVENT_DETAILS_LOADER_ID, null, eventDetailsLoaderCallbacks);
}
 
开发者ID:OpnTec,项目名称:ots15-companion,代码行数:20,代码来源:FossasiaEventDetailsFragment.java

示例11: startLoaders

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void startLoaders(@Nullable final Assignment assignment) {
    if (assignment != null) {
        // build the args used for various loaders
        final Bundle args = new Bundle(3);
        args.putString(ARG_GUID, mGuid);
        args.putString(ARG_MINISTRY_ID, assignment.getMinistryId());
        args.putString(ARG_MCC, assignment.getMcc().toString());

        // start loaders
        final LoaderManager manager = this.getLoaderManager();
        if (assignment.getMcc() == Mcc.GCM) {
            manager.initLoader(LOADER_CHURCHES, args, mLoaderCallbacksChurches);
        }
        if (assignment.getMcc() != Mcc.UNKNOWN) {
            manager.initLoader(LOADER_TRAININGS, args, mLoaderCallbacksTraining);
        }
    }
}
 
开发者ID:GlobalTechnology,项目名称:gma-android,代码行数:19,代码来源:MapFragment.java

示例12: onActivityCreated

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mAdapter = new AltCursorAdapter(getActivity(), new int[]{R.layout.news_item}, null,
            new String[]{DB.MyNews.FEED_ID, DB.News.TITLE, DB.News.PUBLISHED_DATE},
            new int[]{R.id.news_feed, R.id.news_title, R.id.news_date});

    mAdapter.setViewBinder(new BinderNews(getActivity()));
    setListAdapter(mAdapter);

    initUI();

    // on screen orientation changes, the loaders will return the last result,
    // without doing the background work again
    LoaderManager lm = getLoaderManager();
    lm.initLoader(LoaderIds.CURSOR_GET_STARRED, null, cursorCallbacks);
}
 
开发者ID:ediTLJ,项目名称:novelty,代码行数:19,代码来源:BookmarksFragment.java

示例13: onActivityCreated

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    final LoaderManager manager = getLoaderManager();

    // Initialize the search adapter
    mAdapter = new SearchAdapter(getActivity());
    mList.setAdapter(mAdapter);

    // Create callbacks before the initial loader is started
    mLoaderCallbacks = new CursorLoaderCallbacks();

    // Reconnect to the loader only if present
    manager.initLoader(LOADER_ID_SEARCH, null, mLoaderCallbacks);

    // If there is a search term, put it in the text field
    if (!TextUtils.isEmpty(mSearchTerm)) {
        mSearch.setText(mSearchTerm);
        mSearch.selectAll();
    }

    // Always start with an empty filter
    filter("");
}
 
开发者ID:jrconlin,项目名称:mc_backup,代码行数:26,代码来源:PinSiteDialog.java

示例14: onActivityCreated

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mMessageHelper = MessageHelper.getInstance(getActivity());

    initializeMessageList();

    // This needs to be done before initializing the cursor loader below
    initializeSortSettings();

    mLoaderJustInitialized = true;
    LoaderManager loaderManager = getLoaderManager();
    int len = mAccountUuids.length;
    mCursors = new Cursor[len];
    mCursorValid = new boolean[len];
    for (int i = 0; i < len; i++) {
        loaderManager.initLoader(i, null, this);
        mCursorValid[i] = false;
    }
}
 
开发者ID:thialfihar,项目名称:k-9,代码行数:22,代码来源:MessageListFragment.java

示例15: onCreate

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	setRetainInstance(true);
	
	// Check for a Item ID as an argument, and find the item
	Bundle args = getArguments();
	if (args != null) {
		long itemId = args.getLong(ARG_ITEM_ID, -1);
		if (itemId != -1) {
			LoaderManager lm = getLoaderManager();
			lm.initLoader(R.id.item_detail_fragment, args, new ItemLoaderCallbacks());
		}
	}
}
 
开发者ID:dbooga,项目名称:MonsterHunter3UDatabase,代码行数:17,代码来源:ItemDetailFragment.java


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