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


Java CursorLoader类代码示例

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


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

示例1: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {

    String[]  projectionFields = new String[]{
        ContactsContract.Contacts._ID,
            ContactsContract.Contacts.DISPLAY_NAME,
            ContactsContract.Contacts.PHOTO_URI
    };


    CursorLoader cursorLoader = new CursorLoader(MainActivity.this,
            ContactsContract.Contacts.CONTENT_URI,
            projectionFields,
            null,
            null,
            null);

    return cursorLoader;
}
 
开发者ID:micromasterandroid,项目名称:androidbeginners-Lesson3,代码行数:20,代码来源:MainActivity.java

示例2: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    Uri uri;
    switch (id) {
        case LOADER_CAN_UPDATE:
            uri = AppProvider.getCanUpdateUri();
            break;

        case LOADER_KNOWN_VULN:
            uri = AppProvider.getInstalledWithKnownVulnsUri();
            break;

        default:
            throw new IllegalStateException("Unknown loader requested: " + id);
    }

    return new CursorLoader(
            activity, uri, Schema.AppMetadataTable.Cols.ALL, null, null, Schema.AppMetadataTable.Cols.NAME);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:20,代码来源:UpdatesAdapter.java

示例3: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public CursorLoader onCreateLoader(int id, Bundle args) {
    Uri uri;
    if (TextUtils.isEmpty(currentFilterString)) {
        uri = InstalledAppProvider.getContentUri();
    } else {
        uri = InstalledAppProvider.getSearchUri(currentFilterString);
    }
    return new CursorLoader(
            getActivity(),
            uri,
            InstalledAppTable.Cols.ALL,
            null,
            null,
            InstalledAppTable.Cols.APPLICATION_LABEL);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:17,代码来源:SelectAppsView.java

示例4: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
    //checking on rotate
    if (mAttachedFragment != null && mAttachedFragment.getActivity() != null) {


        if (favflag == 0) {
            return new CursorLoader(mAttachedFragment.getActivity(), NewsProvider.MyNews.CONTENT_URI,
                    null,
                    null,
                    null,
                    null);
        } else {
            if (favflag == 1) {
                return new CursorLoader(mAttachedFragment.getActivity(), NewsProvider.NewsFavourite.CONTENT_URI_FAVOURITE,
                        null,
                        null,
                        null,
                        null);

            }
        }
    }
    return null;
}
 
开发者ID:vikasdesale,项目名称:News24x7-news-from-every-part-of-the-world,代码行数:26,代码来源:NewsLoader.java

示例5: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String selection = "";
    if (mOnlyWithPhoneNumbers) {
        selection = ContactsContract.Contacts.HAS_PHONE_NUMBER;
    }
    switch (id) {
        case CONTACTS_LOADER_ID:
            return new CursorLoader(this, CONTACTS_URI, CONTACTS_PROJECTION,
                    selection, null, CONTACTS_SORT);
        case CONTACT_DETAILS_LOADER_ID:
            return new CursorLoader(this, CONTACT_DETAILS_URI, CONTACT_DETAILS_PROJECTION,
                    selection, null, null);
        case GROUPS_LOADER_ID:
            return new CursorLoader(this, GROUPS_URI, GROUPS_PROJECTION, GROUPS_SELECTION, null, GROUPS_SORT);
    }
    return null;
}
 
开发者ID:adithya321,项目名称:SOS-The-Healthcare-Companion,代码行数:19,代码来源:ContactPickerActivity.java

示例6: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    CursorLoader loader = new CursorLoader(getContext());
    loader.setUri(ChuckContentProvider.TRANSACTION_URI);
    if (!TextUtils.isEmpty(currentFilter)) {
        if (TextUtils.isDigitsOnly(currentFilter)) {
            loader.setSelection("responseCode LIKE ?");
            loader.setSelectionArgs(new String[]{ currentFilter + "%" });
        } else {
            loader.setSelection("path LIKE ?");
            loader.setSelectionArgs(new String[]{ "%" + currentFilter + "%" });
        }
    }
    loader.setProjection(HttpTransaction.PARTIAL_PROJECTION);
    loader.setSortOrder("requestDate DESC");
    return loader;
}
 
开发者ID:jgilfelt,项目名称:chuck,代码行数:18,代码来源:TransactionListFragment.java

示例7: getRealPathBelowVersion

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
private static String getRealPathBelowVersion(Context context, Uri uri) {
    String filePath = null;
    LogUtils.i(TAG, "method -> getRealPathBelowVersion " + uri + "   path:" + uri.getPath() + "    getAuthority:" + uri.getAuthority());
    String[] projection = {MediaStore.Images.Media.DATA};

    CursorLoader loader = new CursorLoader(context, uri, projection, null,
            null, null);
    Cursor cursor = loader.loadInBackground();

    if (cursor != null) {
        cursor.moveToFirst();
        filePath = cursor.getString(cursor.getColumnIndex(projection[0]));
        cursor.close();
    }
    if (filePath == null) {
        filePath = uri.getPath();

    }
    return filePath;
}
 
开发者ID:Justson,项目名称:AgentWeb,代码行数:21,代码来源:AgentWebUtils.java

示例8: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
/**
 * Creates and returns a CursorLoader that loads the data for our URI and stores it in a Cursor.
 *
 * @param loaderId The loader ID for which we need to create a loader
 * @param loaderArgs Any arguments supplied by the caller
 *
 * @return A new Loader instance that is ready to start loading.
 */
@Override
public Loader<Cursor> onCreateLoader(int loaderId, Bundle loaderArgs) {

    switch (loaderId) {

        case ID_DETAIL_LOADER:

            return new CursorLoader(this,
                    mUri,
                    WEATHER_DETAIL_PROJECTION,
                    null,
                    null,
                    null);

        default:
            throw new RuntimeException("Loader Not Implemented: " + loaderId);
    }
}
 
开发者ID:gmontoya2483,项目名称:GoUbiquitous,代码行数:27,代码来源:DetailActivity.java

示例9: getRealPathFromURI_API11to18

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@SuppressLint("NewApi")
public static String getRealPathFromURI_API11to18(Context context, Uri contentUri) {
    String[] proj = { MediaStore.Images.Media.DATA };
    String result = null;
    try {
        CursorLoader cursorLoader = new CursorLoader(context, contentUri, proj, null, null, null);
        Cursor cursor = cursorLoader.loadInBackground();

        if (cursor != null) {
            int column_index =
                    cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
            cursor.moveToFirst();
            result = cursor.getString(column_index);
        }
    }
    catch (Exception e){
        e.printStackTrace();
    }
    return result;
}
 
开发者ID:afiqiqmal,项目名称:MVP-Android,代码行数:21,代码来源:RealPathUtils.java

示例10: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int loaderId, Bundle bundle) {

    switch (loaderId) {

        case ID_FORECAST_LOADER:
            Uri forecastQueryUri = WeatherContract.WeatherEntry.CONTENT_URI;
            String sortOrder = WeatherContract.WeatherEntry.COLUMN_DATE + " ASC";
            String selection = WeatherContract.WeatherEntry.getSqlSelectForTodayOnwards();

            return new CursorLoader(this,
                    forecastQueryUri,
                    MAIN_FORECAST_PROJECTION,
                    selection,
                    null,
                    sortOrder);

        default:
            throw new RuntimeException("Loader Not Implemented: " + loaderId);
    }
}
 
开发者ID:changja88,项目名称:Android_Sunshine_Watch,代码行数:22,代码来源:MainActivity.java

示例11: newInstance

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
public static CursorLoader newInstance(Context context, Album album, boolean capture) {
    if (album.isAll()) {
        return new AlbumMediaLoader(
                context,
                QUERY_URI,
                PROJECTION,
                SELECTION_ALL,
                SELECTION_ALL_ARGS,
                ORDER_BY,
                capture);
    } else {
        return new AlbumMediaLoader(
                context,
                QUERY_URI,
                PROJECTION,
                SELECTION_ALBUM,
                getSelectionAlbumArgs(album.getId()),
                ORDER_BY,
                false);
    }
}
 
开发者ID:GitPhoenix,项目名称:VanGogh,代码行数:22,代码来源:AlbumMediaLoader.java

示例12: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String[] projection = {
            PlantEntry._ID,
            PlantEntry.COLUMN_NAME,
            PlantEntry.COLUMN_PRICE,
            PlantEntry.COLUMN_CART_QUANTITY
    };
    String selection = PlantEntry.COLUMN_CART_QUANTITY + " > 0";
    return new CursorLoader(this,
            PlantEntry.CONTENT_URI,
            projection,
            selection,
            null,
            null);
}
 
开发者ID:laramartin,项目名称:android_firebase_green_thumb,代码行数:17,代码来源:ShoppingCartActivity.java

示例13: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String[] projection = {
            PlantEntry._ID,
            PlantEntry.COLUMN_NAME,
            PlantEntry.COLUMN_DESCRIPTION,
            PlantEntry.COLUMN_PRICE
    };
    String selection = PlantEntry._ID + " = " + mItemId;
    return new CursorLoader(this,
            PlantEntry.CONTENT_URI,
            projection,
            selection,
            null,
            null);
}
 
开发者ID:laramartin,项目名称:android_firebase_green_thumb,代码行数:17,代码来源:PlantDetailActivity.java

示例14: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
    // This is called when a new Loader needs to be created.  This
    // fragment only uses one loader, so we don't care about checking the id.

    // To only show current and future dates, filter the query to return weather only for
    // dates after or including today.

    // Sort order:  Ascending, by date.
    String sortOrder = WeatherContract.WeatherEntry.COLUMN_DATE + " ASC";

    String locationSetting = Utility.getPreferredLocation(getActivity());
    Uri weatherForLocationUri = WeatherContract.WeatherEntry.buildWeatherLocationWithStartDate(
            locationSetting, System.currentTimeMillis());

    return new CursorLoader(getActivity(),
            weatherForLocationUri,
            FORECAST_COLUMNS,
            null,
            null,
            sortOrder);
}
 
开发者ID:changja88,项目名称:Udacity_Sunshine,代码行数:23,代码来源:ForecastFragment.java

示例15: onCreateLoader

import android.support.v4.content.CursorLoader; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (id == CHANNELS_LOADER) {
        return new CursorLoader(
                getActivity(),
                ChannelEntry.CONTENT_URI,
                CHANNEL_COLUMNS,
                TextUtils.isEmpty(category) ? null
                        : ChannelEntry.TABLE_NAME + "."
                        + ChannelEntry.COLUMN_CHANNEL_CATEGORY_ID + " = ?",
                TextUtils.isEmpty(category) ? null :
                        new String[]{String.valueOf(category)},
                Utility.getPrefSortChannelOrder(sortBy));
    }
    return null;
}
 
开发者ID:graviton57,项目名称:TVGuide,代码行数:17,代码来源:ChannelFragment.java


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