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


Java Loader类代码示例

本文整理汇总了Java中android.content.Loader的典型用法代码示例。如果您正苦于以下问题:Java Loader类的具体用法?Java Loader怎么用?Java Loader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onCreateLoader

import android.content.Loader; //导入依赖的package包/类
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    // Now create and return a CursorLoader that will take care of
    // creating a Cursor for the data being displayed.
    if(id == LOADER_ID_HISTORY) {
        return new CursorLoader(this, ActivityDiaryContract.Diary.CONTENT_URI,
                PROJECTION, SELECTION, null, null);
    }else{

        return new CursorLoader(HistoryActivity.this,
                ActivityDiaryContract.DiaryImage.CONTENT_URI,
                new String[] {ActivityDiaryContract.DiaryImage._ID,
                        ActivityDiaryContract.DiaryImage.URI},
                ActivityDiaryContract.DiaryImage.DIARY_ID + "=? AND "
                        + ActivityDiaryContract.DiaryImage._DELETED + "=0",
                new String[] {Long.toString(args.getLong("DiaryID"))},
                null);
    }
}
 
开发者ID:ramack,项目名称:ActivityDiary,代码行数:19,代码来源:HistoryActivity.java

示例2: onCreateLoader

import android.content.Loader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
    return new CursorLoader(this,
            // Retrieve data rows for the device user's 'profile' contact.
            Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
                    ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,

            // Select only email addresses.
            ContactsContract.Contacts.Data.MIMETYPE +
                    " = ?", new String[]{ContactsContract.CommonDataKinds.Email
            .CONTENT_ITEM_TYPE},

            // Show primary email addresses first. Note that there won't be
            // a primary email address if the user hasn't specified one.
            ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
 
开发者ID:BobbyZhang93,项目名称:BestBlog,代码行数:17,代码来源:LoginActivity.java

示例3: onCreateLoader

import android.content.Loader; //导入依赖的package包/类
@Override
public Loader onCreateLoader(final int id, final Bundle args) {
    switch (id) {
        case SavedEntriesQueryLoader.ID:
            return new SavedEntriesQueryLoader(getActivity(), getSortOrder());
        case SavedEntriesDeleteLoader.ID:
            return new SavedEntriesDeleteLoader(getActivity(),
                    args.getIntegerArrayList(KEY_POSITIONS));
        default:
            return null;
    }
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:13,代码来源:SavedEntriesFragment.java

示例4: onLoadFinished

import android.content.Loader; //导入依赖的package包/类
@Override
public void onLoadFinished(final Loader<Address> loader, final Address currentAddress) {
    if (!currentAddress.equals(currentAddressQrAddress)) {
        currentAddressQrAddress = new AddressAndLabel(currentAddress, config.getOwnName());

        final String addressStr = BitcoinURI.convertToBitcoinURI(currentAddressQrAddress.address, null,
                currentAddressQrAddress.label, null);

        currentAddressQrBitmap = new BitmapDrawable(getResources(), Qr.bitmap(addressStr));
        currentAddressQrBitmap.setFilterBitmap(false);

        currentAddressUriRef.set(addressStr);

        updateView();
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:17,代码来源:WalletAddressFragment.java

示例5: onChange

import android.content.Loader; //导入依赖的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

示例6: onLoadFinished

import android.content.Loader; //导入依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
    if (!isAdded()) {
        if (cursor != null) {
            cursor.close();
        }
        return;
    }

    mCursor = cursor;
    if (mCursor != null && !mCursor.moveToFirst()) {
        Log.e(TAG, "Error reading item detail cursor");
        mCursor.close();
        mCursor = null;
    }

    bindViews();
}
 
开发者ID:rashikaranpuria,项目名称:xyz-reader-2,代码行数:19,代码来源:ArticleDetailFragment.java

示例7: onCreateLoader

import android.content.Loader; //导入依赖的package包/类
@Override
public Loader onCreateLoader(final int id, final Bundle args) {
    switch (id) {
        case IsFeedUpdateAvailableLoader.ID:
            return new IsFeedUpdateAvailableLoader(this);
        case OPMLImportLoader.ID:
            return new OPMLImportLoader(this,
                    Uri.parse(args.getString(KEY_OPML_IMPORT)));
        case SavedEntriesSaveLoader.ID:
            return new SavedEntriesSaveLoader(this,
                    args.getStringArrayList(KEY_ENTRY_URLS),
                    args.getStringArrayList(KEY_ENTRY_TITLES));
        default:
            return null;
    }
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:17,代码来源:MainActivity.java

示例8: onCreateLoader

import android.content.Loader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (id == LOADER_ID_LAST_ADDED) {
        return new LastAddedLoader(getActivity());
    }
    else if (id == LOADER_ID_LAST_PLAYED) {
        return new LastPlayedLoader(getActivity());
    }
    else if (id == LOADER_ID_ALL_TV_SHOWS) {
        if (args == null) {
            return new AllTvshowsLoader(getActivity());
        } else {
            return new AllTvshowsLoader(getActivity(), args.getString("sort"));
        }
    }
    else if (id == LOADER_ID_NON_SCRAPED_VIDEOS_COUNT) {
        return new NonScrapedVideosCountLoader(getActivity());
    }
    else return null;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:21,代码来源:MainFragment.java

示例9: onLoadFinished

import android.content.Loader; //导入依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor c) {
    // List of categories
    if (cursorLoader.getId() == -1) {

        // Empty view visibility
        mEmptyView.setVisibility(c.getCount() > 0 ? View.GONE : View.VISIBLE);

        if (mCurrentCategoriesCursor != null) {
            if (!isCategoriesListModified(mCurrentCategoriesCursor, c)) {
                // no actual modification, no need to rebuild all the rows
                mCurrentCategoriesCursor = c; // keep the reference to the new cursor because the old one won't be valid anymore
                return;
            }
        }
        mCurrentCategoriesCursor = c;
        loadCategoriesRows(c);
    }
    // One of the row
    else {
        CursorObjectAdapter adapter = mAdaptersMap.get(cursorLoader.getId());
        if (adapter != null) {
            adapter.changeCursor(c);
        }
    }
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:27,代码来源:MoviesByFragment.java

示例10: onCreateLoader

import android.content.Loader; //导入依赖的package包/类
@Override
public Loader<List<Book>> onCreateLoader(int i, Bundle bundle) {
    Log.v(LOG_TAG, "TEST: New Loader initialised for the url provided");

    //setting a progress bar whiloe the loader load data
    mProgressBarView.setVisibility(View.VISIBLE);
    bookListView.setVisibility(View.INVISIBLE);
    mEmptyStateTextView.setVisibility(View.GONE);


    String requestUrl = "";
    if (mQuery != null && mQuery != "") {
        requestUrl = GOOGLE_BOOKS_REQUEST_URL + mQuery;
    } else {
        String defaultQuery = "android";
        requestUrl = GOOGLE_BOOKS_REQUEST_URL + defaultQuery;
    }

    // Create a new loader for the given URL
    return new BookListingLoader(this, requestUrl);
}
 
开发者ID:Cherudek,项目名称:Book_Listing,代码行数:22,代码来源:BookListingActivity.java

示例11: onLoadFinished

import android.content.Loader; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void onLoadFinished(final Loader loader, final Object data) {
    final int id = loader.getId();

    switch (id) {
        case SavedEntriesQueryLoader.ID:
            onDbQueryResult();
            break;
        case SavedEntriesDeleteLoader.ID:
            onSavedEntriesDeleted((List<Integer>) data);
            break;
    }

    getLoaderManager().destroyLoader(id);
}
 
开发者ID:Applications-Development,项目名称:SimpleRssReader,代码行数:17,代码来源:SavedEntriesFragment.java

示例12: onLoadFinished

import android.content.Loader; //导入依赖的package包/类
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    // Swap the new cursor in.  (The framework will take care of closing the
    // old cursor once we return.)
    int i = loader.getId();
    if(i == LOADER_ID_HISTORY) {
        historyAdapter.swapCursor(data);
    }else{
        detailAdapters[i].swapCursor(data);
    }

}
 
开发者ID:ramack,项目名称:ActivityDiary,代码行数:12,代码来源:HistoryActivity.java

示例13: onLoadFinished

import android.content.Loader; //导入依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
    List<String> user = new ArrayList<>();
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        user.add(cursor.getString(ProfileQuery.ADDRESS));
        cursor.moveToNext();
    }

    addEmailsToAutoComplete(user);
}
 
开发者ID:hacktoberfest17,项目名称:programming,代码行数:12,代码来源:Login.java

示例14: onCreateLoader

import android.content.Loader; //导入依赖的package包/类
@Override
public Loader<LocalMessage> onCreateLoader(int id, Bundle args) {
    if (id != LOCAL_MESSAGE_LOADER_ID) {
        throw new IllegalStateException("loader id must be message loader id");
    }

    return new LocalMessageLoader(context, MessagingController.getInstance(context), account, messageReference);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:9,代码来源:MessageLoaderHelper.java

示例15: onLoadFinished

import android.content.Loader; //导入依赖的package包/类
@Override
public void onLoadFinished(Loader<LocalMessage> loader, LocalMessage message) {
    if (loader.getId() != LOCAL_MESSAGE_LOADER_ID) {
        throw new IllegalStateException("loader id must be message loader id");
    }

    localMessage = message;
    if (message == null) {
        onLoadMessageFromDatabaseFailed();
    } else {
        onLoadMessageFromDatabaseFinished();
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:14,代码来源:MessageLoaderHelper.java


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