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


Java DatabaseUtilsCompat.appendSelectionArgs方法代码示例

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


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

示例1: onCreateLoader

import android.support.v4.database.DatabaseUtilsCompat; //导入方法依赖的package包/类
@Override
public Loader<List<com.rks.musicx.data.model.Album>> onCreateLoader(int id, Bundle args) {
    if (id == albumLoaders) {
        AlbumLoader albumLoader = new AlbumLoader(getContext());
        String[] selectargs = getSelectionArgs();
        String selection = getSelection();
        if (artist.getName() != null) {
            selection = DatabaseUtilsCompat.concatenateWhere(selection, MediaStore.Audio.Albums.ARTIST + " = ?");
            selectargs = DatabaseUtilsCompat.appendSelectionArgs(selectargs, new String[]{artist.getName()});
        }
        albumLoader.setSortOrder(Extras.getInstance().getArtistAlbumSort());
        albumLoader.filterartistsong(selection, selectargs);
        return albumLoader;
    }
    return null;
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:17,代码来源:ArtistFragment.java

示例2: getCursor

import android.support.v4.database.DatabaseUtilsCompat; //导入方法依赖的package包/类
@Nullable
protected Cursor getCursor(Uri musicUri, String[] projection, String selection, String[] selectionArgs, String filteredFieldName, String filter, String orderBy) {
    if (!Utils.checkPermission(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE)) {
        return null;
    }

    Cursor cursor;
    if (filter != null) {
        if (filter.equals("")) {
            return null; // empty filter means that we don't want any result
        }
        selection = DatabaseUtilsCompat.concatenateWhere(selection, filteredFieldName + " LIKE ?");
        selectionArgs = DatabaseUtilsCompat.appendSelectionArgs(selectionArgs, new String[]{"%" + filter + "%"});

    }

    cursor = getContext().getContentResolver().query(musicUri, projection,
            selection, selectionArgs,
            orderBy);


    return cursor;
}
 
开发者ID:andryr,项目名称:Harmony-Music-Player,代码行数:24,代码来源:BaseLoader.java

示例3: getAlbumCursor

import android.support.v4.database.DatabaseUtilsCompat; //导入方法依赖的package包/类
private Cursor getAlbumCursor() {

        Uri musicUri = MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI;

        String selection = getSelectionString();
        String[] selectionArgs = getSelectionArgs();
        if (mArtist != null) {
            selection = DatabaseUtilsCompat.concatenateWhere(selection, MediaStore.Audio.Albums.ARTIST + " = ?");
            selectionArgs = DatabaseUtilsCompat.appendSelectionArgs(selectionArgs, new String[]{mArtist});

        }

        String fieldName = MediaStore.Audio.Albums.ALBUM;
        String filter = getFilter();
        return getCursor(musicUri, sProjection, selection, selectionArgs, fieldName, filter);
    }
 
开发者ID:andryr,项目名称:Harmony-Music-Player,代码行数:17,代码来源:AlbumLoader.java

示例4: getCursor

import android.support.v4.database.DatabaseUtilsCompat; //导入方法依赖的package包/类
@Nullable
private Cursor getCursor(Uri musicUri, String[] projection, String selection, String[] selectionArgs, String filteredFieldName, String filter, String orderBy) {
    if (!Permissions.checkPermission(getContext())) {
        return null;
    }


    if (filter != null) {
        if ("".equals(filter)) {
            return null; // empty filter means that we don't want any result
        }
        selection = DatabaseUtilsCompat.concatenateWhere(selection, filteredFieldName + " LIKE ?");
        selectionArgs = DatabaseUtilsCompat.appendSelectionArgs(selectionArgs, new String[]{"%" + filter + "%"});

    }


    return getContext().getContentResolver().query(musicUri, projection, selection, selectionArgs, orderBy);
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:20,代码来源:BaseLoader.java

示例5: query

import android.support.v4.database.DatabaseUtilsCompat; //导入方法依赖的package包/类
/**
 * Handle incoming queries.
 */
@Override
public Cursor query(Uri uri, String[] projection, String selection,
        String[] selectionArgs, String sortOrder) {

    // Constructs a new query builder and sets its table name
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
    qb.setTables(MainTable.TABLE_NAME);

    switch (mUriMatcher.match(uri)) {
        case MAIN:
            // If the incoming URI is for main table.
            qb.setProjectionMap(mNotesProjectionMap);
            break;

        case MAIN_ID:
            // The incoming URI is for a single row.
            qb.setProjectionMap(mNotesProjectionMap);
            qb.appendWhere(MainTable._ID + "=?");
            selectionArgs = DatabaseUtilsCompat.appendSelectionArgs(selectionArgs,
                    new String[] { uri.getLastPathSegment() });
            break;

        default:
            throw new IllegalArgumentException("Unknown URI " + uri);
    }


    if (TextUtils.isEmpty(sortOrder)) {
        sortOrder = MainTable.DEFAULT_SORT_ORDER;
    }

    SQLiteDatabase db = mOpenHelper.getReadableDatabase();

    Cursor c = qb.query(db, projection, selection, selectionArgs,
            null /* no group */, null /* no filter */, sortOrder);

    c.setNotificationUri(getContext().getContentResolver(), uri);
    return c;
}
 
开发者ID:reknih,项目名称:informant-droid,代码行数:43,代码来源:LoaderThrottleSupport.java

示例6: getAlbumCursor

import android.support.v4.database.DatabaseUtilsCompat; //导入方法依赖的package包/类
private Cursor getAlbumCursor(String nomartist) {

        Uri musicUri = MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI;

        String selection = getSelectionString();
        String[] selectionArgs = getSelectionArgs();


        Log.d(TAG, "getAlbumCursor() " + nomartist  );

        if (mArtist != null) {

            Log.d(TAG, "getAlbumCursor() (mArtist != null) "  );

            selection = DatabaseUtilsCompat.concatenateWhere(selection, MediaStore.Audio.Albums.ARTIST + " = ?");
            selectionArgs = DatabaseUtilsCompat.appendSelectionArgs(selectionArgs, new String[]{nomartist});

        }

        String fieldName = MediaStore.Audio.Albums.ALBUM;
        String filter = getFilter();
        return getCursor(musicUri, sProjection, selection, selectionArgs, fieldName, filter);
    }
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:24,代码来源:AlbumLoader.java

示例7: query

import android.support.v4.database.DatabaseUtilsCompat; //导入方法依赖的package包/类
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
{
	// Constructs a new query builder and sets its table name
	SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
	String finalSortOrder = sortOrder;
	String[] finalSelectionArgs = selectionArgs;
	String finalGrouping = null;
	String finalHaving = null;
	int matched = URI_MATCHER.match(uri);
	boolean isMatch = false;
	int length = tableInfos.length;
	for (int i = 0; i < length; i++)
	{
		TableInfo tableInfo = tableInfos[i];
		if (matched == tableInfo.table)
		{
			qb.setTables(tableInfo.tableName);
			if (sortOrder == null)
			{
				finalSortOrder = tableInfo.field_id + " ASC";
			}
			isMatch = true;
			break;
		}
		else if (matched == tableInfo.table_id)
		{
			qb.setTables(tableInfo.tableName);
			qb.appendWhere(tableInfo.field_id + " = ? ");
			finalSelectionArgs = DatabaseUtilsCompat.appendSelectionArgs(selectionArgs, new String[]{uri.getLastPathSegment()});
			isMatch = true;
			break;
		}
	}
	if (!isMatch)
	{
		throw new IllegalArgumentException(UNKNOWN_URI_LOG + uri);
	}
	SQLiteDatabase db = mOpenHelper.getReadableDatabase();
	Cursor c = qb.query(db, projection, selection, finalSelectionArgs, finalGrouping, finalHaving, finalSortOrder);
	return c;
}
 
开发者ID:libit,项目名称:lr_dialer,代码行数:43,代码来源:DataBaseProvider.java


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