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


Java AudioColumns.ARTIST_ID属性代码示例

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


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

示例1: getSongListForArtist

/**
 * @param context The {@link Context} to use.
 * @param id      The ID of the artist.
 * @return The song list for an artist.
 */
public static final long[] getSongListForArtist(final Context context, final long id) {
    final String[] projection = new String[]{
            BaseColumns._ID
    };
    final String selection = AudioColumns.ARTIST_ID + "=" + id + " AND "
            + AudioColumns.IS_MUSIC + "=1";
    Cursor cursor = context.getContentResolver().query(
            MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection, null,
            AudioColumns.ALBUM_KEY + "," + AudioColumns.TRACK);
    if (cursor != null) {
        final long[] mList = getSongListForCursor(cursor);
        cursor.close();
        cursor = null;
        return mList;
    }
    return sEmptyList;
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:22,代码来源:MusicUtils.java

示例2: getSongListForArtist

/**
 * @param context
 * @param id
 * @return
 */
public static long[] getSongListForArtist(Context context, long id) {
    final String[] projection = new String[] {
        BaseColumns._ID
    };
    String selection = AudioColumns.ARTIST_ID + "=" + id + " AND " + AudioColumns.IS_MUSIC
            + "=1";
    String sortOrder = AudioColumns.ALBUM_KEY + "," + AudioColumns.TRACK;
    Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
    Cursor cursor = query(context, uri, projection, selection, null, sortOrder);
    if (cursor != null) {
        long[] list = getSongListForCursor(cursor);
        cursor.close();
        return list;
    }
    return sEmptyList;
}
 
开发者ID:cpoopc,项目名称:com.cp.monsterMod,代码行数:21,代码来源:MusicUtils.java

示例3: getSongListForArtist

/**
 * @param context The {@link Context} to use.
 * @param id The ID of the artist.
 * @return The song list for an artist.
 */
public static final long[] getSongListForArtist(final Context context, final String id) {
    final String[] projection = new String[] {
        BaseColumns._ID
    };
    final String selection = AudioColumns.ARTIST_ID + "=" + id + " AND "
            + AudioColumns.IS_MUSIC + "=1";
    Cursor cursor = context.getContentResolver().query(
            MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection, null,
            AudioColumns.ALBUM_KEY + "," + AudioColumns.TRACK);
    if (cursor != null) {
        final long[] mList = getSongListForCursor(cursor);
        cursor.close();
        cursor = null;
        return mList;
    }
    return sEmptyList;
}
 
开发者ID:micromacer,项目名称:Player-by-TweekProject,代码行数:22,代码来源:MusicUtils.java

示例4: reloadQueueCursor

/**
 * Reload the queue after we remove a track
 */
private void reloadQueueCursor() {
    if (mPlaylistId == PLAYLIST_QUEUE) {
        String[] cols = new String[] {
                BaseColumns._ID, MediaColumns.TITLE, MediaColumns.DATA, AudioColumns.ALBUM,
                AudioColumns.ARTIST, AudioColumns.ARTIST_ID
        };
        StringBuilder selection = new StringBuilder();
        selection.append(AudioColumns.IS_MUSIC + "=1");
        selection.append(" AND " + MediaColumns.TITLE + " != ''");
        Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
        long[] mNowPlaying = MusicUtils.getQueue();
        if (mNowPlaying.length == 0) {
        }
        selection = new StringBuilder();
        selection.append(BaseColumns._ID + " IN (");
        for (int i = 0; i < mNowPlaying.length; i++) {
            selection.append(mNowPlaying[i]);
            if (i < mNowPlaying.length - 1) {
                selection.append(",");
            }
        }
        selection.append(")");
        mCursor = MusicUtils.query(getActivity(), uri, cols, selection.toString(), null, null);
        mTrackAdapter.changeCursor(mCursor);
    }
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:29,代码来源:TracksFragment.java

示例5: reloadQueueCursor

/**
   * Reload the queue after we remove a track
   */
  private void reloadQueueCursor() {
      String[] cols = new String[] {
              BaseColumns._ID, MediaColumns.TITLE, MediaColumns.DATA, AudioColumns.ALBUM,
              AudioColumns.ARTIST, AudioColumns.ARTIST_ID
      };
      StringBuilder selection = new StringBuilder();
      selection.append(AudioColumns.IS_MUSIC + "=1");
      selection.append(" AND " + MediaColumns.TITLE + " != ''");
      Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
      long[] mNowPlaying = MusicUtils.getQueue();
      if (mNowPlaying.length == 0) {
      }
      selection = new StringBuilder();
      selection.append(BaseColumns._ID + " IN (");
      for (int i = 0; i < mNowPlaying.length; i++) {
          selection.append(mNowPlaying[i]);
          if (i < mNowPlaying.length - 1) {
              selection.append(",");
          }
      }
      selection.append(")");
if(mCursor != null)
	mCursor.close();
      mCursor = MusicUtils.query(getActivity(), uri, cols, selection.toString(), null, null);
      String[] audioCols = new String[] { BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ARTIST, AudioColumns.ALBUM}; 
      MatrixCursor playlistCursor = new MatrixCursor(audioCols);
  	for(int i = 0; i < mNowPlaying.length; i++){
  		mCursor.moveToPosition(-1);
  		while (mCursor.moveToNext()) {
              long audioid = mCursor.getLong(mCursor.getColumnIndexOrThrow(BaseColumns._ID));
          	if( audioid == mNowPlaying[i]) {
                  String trackName = mCursor.getString(mCursor.getColumnIndexOrThrow(MediaColumns.TITLE));
                  String artistName = mCursor.getString(mCursor.getColumnIndexOrThrow(AudioColumns.ARTIST));
                  String albumName = mCursor.getString(mCursor.getColumnIndexOrThrow(AudioColumns.ALBUM));
          		playlistCursor.addRow(new Object[] {audioid, trackName, artistName ,albumName});

          	}
          }
  	}
if(mCursor != null)
	mCursor.close();
      mCursor = playlistCursor;
      mAdapter.changeCursor(playlistCursor);
  }
 
开发者ID:hubcarl,项目名称:mobile-manager-tool,代码行数:47,代码来源:NowPlayingFragment.java


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