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


Java Albums类代码示例

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


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

示例1: getAlbum

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
/**
 * @Description 得到原图
 */
@SuppressWarnings("unused")
private void getAlbum() {
    String[] projection = {
            Albums._ID, Albums.ALBUM, Albums.ALBUM_ART,
            Albums.ALBUM_KEY, Albums.ARTIST, Albums.NUMBER_OF_SONGS
    };
    Cursor cursor = null;
    try {
        cursor = contentResolver.query(Albums.EXTERNAL_CONTENT_URI,
                projection, null, null, null);
        getAlbumColumnData(cursor);
    } catch (Exception e) {
        logger.e(e.getMessage());
    } finally {
        if (null != cursor) {
            cursor.close();
        }
    }

}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:24,代码来源:AlbumHelper.java

示例2: getAlbum

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
/**
 * 得到原图
 */
void getAlbum() {
    String[] projection = {Albums._ID, Albums.ALBUM, Albums.ALBUM_ART,
            Albums.ALBUM_KEY, Albums.ARTIST, Albums.NUMBER_OF_SONGS};
    Cursor cursor = cr.query(Albums.EXTERNAL_CONTENT_URI, projection, null,
            null, null);
    getAlbumColumnData(cursor);

}
 
开发者ID:gitxuyulin,项目名称:EditorImageAndText,代码行数:12,代码来源:AlbumHelper.java

示例3: getAlbumColumnData

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
/**
 * 从数据库中得到原图
 * 
 * @param cur
 */
private void getAlbumColumnData(Cursor cur) {
    try {
        if (cur.moveToFirst()) {
            int _id;
            String album;
            String albumArt;
            String albumKey;
            String artist;
            int numOfSongs;

            int _idColumn = cur.getColumnIndex(Albums._ID);
            int albumColumn = cur.getColumnIndex(Albums.ALBUM);
            int albumArtColumn = cur.getColumnIndex(Albums.ALBUM_ART);
            int albumKeyColumn = cur.getColumnIndex(Albums.ALBUM_KEY);
            int artistColumn = cur.getColumnIndex(Albums.ARTIST);
            int numOfSongsColumn = cur.getColumnIndex(Albums.NUMBER_OF_SONGS);

            do {
                _id = cur.getInt(_idColumn);
                album = cur.getString(albumColumn);
                albumArt = cur.getString(albumArtColumn);
                albumKey = cur.getString(albumKeyColumn);
                artist = cur.getString(artistColumn);
                numOfSongs = cur.getInt(numOfSongsColumn);
                HashMap<String, String> hash = new HashMap<String, String>();
                hash.put("_id", _id + "");
                hash.put("album", album);
                hash.put("albumArt", albumArt);
                hash.put("albumKey", albumKey);
                hash.put("artist", artist);
                hash.put("numOfSongs", numOfSongs + "");
                albumList.add(hash);
            } while (cur.moveToNext());

        }
    } catch (Exception e) {
        logger.e(e.getMessage());
    }
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:45,代码来源:AlbumHelper.java

示例4: getAlbum

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
void getAlbum() {
	String[] projection = { Albums._ID, Albums.ALBUM, Albums.ALBUM_ART,
			Albums.ALBUM_KEY, Albums.ARTIST, Albums.NUMBER_OF_SONGS };
	Cursor cursor = cr.query(Albums.EXTERNAL_CONTENT_URI, projection, null,
			null, null);
	getAlbumColumnData(cursor);

}
 
开发者ID:androidWeq,项目名称:ItHome,代码行数:9,代码来源:AlbumHelper.java

示例5: getAlbum

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
/**
 * �õ�ԭͼ
 */
void getAlbum() {
	String[] projection = { Albums._ID, Albums.ALBUM, Albums.ALBUM_ART,
			Albums.ALBUM_KEY, Albums.ARTIST, Albums.NUMBER_OF_SONGS };
	Cursor cursor = cr.query(Albums.EXTERNAL_CONTENT_URI, projection, null,
			null, null);
	getAlbumColumnData(cursor);

}
 
开发者ID:linmp4,项目名称:quickmark,代码行数:12,代码来源:AlbumHelper.java

示例6: getAlbum

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
void getAlbum() {
	String[] projection = { Albums._ID, Albums.ALBUM, Albums.ALBUM_ART, Albums.ALBUM_KEY, Albums.ARTIST,
			Albums.NUMBER_OF_SONGS };
	Cursor cursor = cr.query(Albums.EXTERNAL_CONTENT_URI, projection, null, null, null);
	getAlbumColumnData(cursor);

}
 
开发者ID:CodeDogandCat,项目名称:CarApp,代码行数:8,代码来源:AlbumHelper.java

示例7: getAlbum

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
public void getAlbum(){
    String[] projection = { Albums._ID, Albums.ALBUM, Albums.ALBUM_ART,
            Albums.ALBUM_KEY, Albums.ARTIST, Albums.NUMBER_OF_SONGS };
    Cursor cursor = resolver.query(Albums.EXTERNAL_CONTENT_URI, projection, null,
            null, Albums._ID+" desc");
    if(cursor.moveToFirst()){
        int _id;
        String album ;
        String albumArt ;
        String albumKey;
        String artist;
        int numOfSongs;
        int _idColumn = cursor.getColumnIndex(Albums._ID);
        int albumColumn = cursor.getColumnIndex(Albums.ALBUM);
        int albumArtColumn = cursor.getColumnIndex(Albums.ALBUM_ART);
        int albumKeyColumn = cursor.getColumnIndex(Albums.ALBUM_KEY);
        int artistColumn = cursor.getColumnIndex(Albums.ARTIST);
        int numOfSongsColumn = cursor.getColumnIndex(Albums.NUMBER_OF_SONGS);
        do {
            _id = cursor.getInt(_idColumn);
            album = cursor.getString(albumColumn);
            albumArt = cursor.getString(albumArtColumn);
            albumKey = cursor.getString(albumKeyColumn);
            artist = cursor.getString(artistColumn);
            numOfSongs = cursor.getInt(numOfSongsColumn);

            HashMap<String, String> hash = new HashMap<>();
            hash.put("_id", _id + "");
            hash.put("album", album);
            hash.put("albumArt", albumArt);
            hash.put("albumKey", albumKey);
            hash.put("artist", artist);
            hash.put("numOfSongs", numOfSongs + "");
            albumList.add(hash);

        }while (cursor.moveToNext());
    }
    cursor.close();
}
 
开发者ID:zillachan,项目名称:LibZilla,代码行数:40,代码来源:AlbumHelper.java

示例8: onItemClick

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
  super.onItemClick(parent, view, position, id);
  albumsView.query(Albums.EXTERNAL_CONTENT_URI, ArtistColumns.ARTIST_KEY + " = '" + getLastSelectedName() + "'");
  getFlipper().setInAnimation(getContext(), R.anim.slide_in_left);
  getFlipper().setOutAnimation(getContext(), R.anim.slide_out_left);
  getFlipper().showNext();
}
 
开发者ID:CarloRodriguez,项目名称:AlarmOn,代码行数:9,代码来源:MediaArtistsView.java

示例9: getAlbum

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
/**
 * 得到原图
 */
void getAlbum() {
	String[] projection = { Albums._ID, Albums.ALBUM, Albums.ALBUM_ART,
			Albums.ALBUM_KEY, Albums.ARTIST, Albums.NUMBER_OF_SONGS };
	Cursor cursor = cr.query(Albums.EXTERNAL_CONTENT_URI, projection, null,
			null, null);
	getAlbumColumnData(cursor);

}
 
开发者ID:cymcsg,项目名称:UltimateAndroid,代码行数:12,代码来源:AlbumHelper.java

示例10: createAlbums

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
/**
 * 创建图片原图集合
 */
private void createAlbums(){
	Cursor cursor = mContentResolver.query(Media.EXTERNAL_CONTENT_URI, ALBUMS_PROJECTION, null, null, null);
	if (cursor.moveToFirst()) {
		int idIndex = cursor.getColumnIndex(Albums._ID);
		int albumIndex  = cursor.getColumnIndex(Albums.ALBUM);
		int albumArtIndex  = cursor.getColumnIndex(Albums.ALBUM_ART);
		int albumKeyIndex  = cursor.getColumnIndex(Albums.ALBUM_KEY);
		int artistIndex  = cursor.getColumnIndex(Albums.ARTIST);
		int numberOfSongsIndex  = cursor.getColumnIndex(Albums.NUMBER_OF_SONGS);
		do {
			int id = cursor.getInt(idIndex);
			int numberOfSongs = cursor.getInt(numberOfSongsIndex);
			String album = cursor.getString(albumIndex);
			String artist = cursor.getString(artistIndex);
			String albumKey = cursor.getString(albumKeyIndex);
			String albumArt = cursor.getString(albumArtIndex);
			Map<String, String> albumItem = new HashMap<String, String>();
			albumItem.put("_id", String.valueOf(id));
			albumItem.put("album", album);
			albumItem.put("albumArt", albumArt);
			albumItem.put("albumKey", albumKey);
			albumItem.put("artist", artist);
			albumItem.put("numOfSongs", String.valueOf(numberOfSongs));
			albums.add(albumItem);
		} while (cursor.moveToNext());
	}
	cursor.close();
}
 
开发者ID:Soniy7x,项目名称:Auie,代码行数:32,代码来源:UEImageManager.java

示例11: getAlbumColumnData

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
/**
 * 从本地数据库中得到原图
 *
 * @param cur
 */
private void getAlbumColumnData(Cursor cur) {
    if (cur.moveToFirst()) {
        int _id;
        String album;
        String albumArt;
        String albumKey;
        String artist;
        int numOfSongs;

        int _idColumn = cur.getColumnIndex(Albums._ID);
        int albumColumn = cur.getColumnIndex(Albums.ALBUM);
        int albumArtColumn = cur.getColumnIndex(Albums.ALBUM_ART);
        int albumKeyColumn = cur.getColumnIndex(Albums.ALBUM_KEY);
        int artistColumn = cur.getColumnIndex(Albums.ARTIST);
        int numOfSongsColumn = cur.getColumnIndex(Albums.NUMBER_OF_SONGS);

        do {
            // Get the field values
            _id = cur.getInt(_idColumn);
            album = cur.getString(albumColumn);
            albumArt = cur.getString(albumArtColumn);
            albumKey = cur.getString(albumKeyColumn);
            artist = cur.getString(artistColumn);
            numOfSongs = cur.getInt(numOfSongsColumn);

            // Do something with the values.
            Log.i(TAG, _id + " album:" + album + " albumArt:" + albumArt
                    + "albumKey: " + albumKey + " artist: " + artist
                    + " numOfSongs: " + numOfSongs + "---");
            HashMap<String, String> hash = new HashMap<String, String>();
            hash.put("_id", _id + "");
            hash.put("album", album);
            hash.put("albumArt", albumArt);
            hash.put("albumKey", albumKey);
            hash.put("artist", artist);
            hash.put("numOfSongs", numOfSongs + "");
            albumList.add(hash);

        } while (cur.moveToNext());
        cur.close();

    }
}
 
开发者ID:gitxuyulin,项目名称:EditorImageAndText,代码行数:49,代码来源:AlbumHelper.java

示例12: getAlbumColumnData

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
private void getAlbumColumnData(Cursor cur) {
	if (cur.moveToFirst()) {
		int _id;
		String album;
		String albumArt;
		String albumKey;
		String artist;
		int numOfSongs;

		int _idColumn = cur.getColumnIndex(Albums._ID);
		int albumColumn = cur.getColumnIndex(Albums.ALBUM);
		int albumArtColumn = cur.getColumnIndex(Albums.ALBUM_ART);
		int albumKeyColumn = cur.getColumnIndex(Albums.ALBUM_KEY);
		int artistColumn = cur.getColumnIndex(Albums.ARTIST);
		int numOfSongsColumn = cur.getColumnIndex(Albums.NUMBER_OF_SONGS);

		do {
			// Get the field values
			_id = cur.getInt(_idColumn);
			album = cur.getString(albumColumn);
			albumArt = cur.getString(albumArtColumn);
			albumKey = cur.getString(albumKeyColumn);
			artist = cur.getString(artistColumn);
			numOfSongs = cur.getInt(numOfSongsColumn);

			// Do something with the values.
			Log.i(TAG, _id + " album:" + album + " albumArt:" + albumArt
					+ "albumKey: " + albumKey + " artist: " + artist
					+ " numOfSongs: " + numOfSongs + "---");
			HashMap<String, String> hash = new HashMap<String, String>();
			hash.put("_id", _id + "");
			hash.put("album", album);
			hash.put("albumArt", albumArt);
			hash.put("albumKey", albumKey);
			hash.put("artist", artist);
			hash.put("numOfSongs", numOfSongs + "");
			albumList.add(hash);

		} while (cur.moveToNext());

	}
}
 
开发者ID:androidWeq,项目名称:ItHome,代码行数:43,代码来源:AlbumHelper.java

示例13: getAlbumColumnData

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
/**
 * �ӱ������ݿ��еõ�ԭͼ
 * 
 * @param cur
 */
private void getAlbumColumnData(Cursor cur) {
	if (cur.moveToFirst()) {
		int _id;
		String album;
		String albumArt;
		String albumKey;
		String artist;
		int numOfSongs;

		int _idColumn = cur.getColumnIndex(Albums._ID);
		int albumColumn = cur.getColumnIndex(Albums.ALBUM);
		int albumArtColumn = cur.getColumnIndex(Albums.ALBUM_ART);
		int albumKeyColumn = cur.getColumnIndex(Albums.ALBUM_KEY);
		int artistColumn = cur.getColumnIndex(Albums.ARTIST);
		int numOfSongsColumn = cur.getColumnIndex(Albums.NUMBER_OF_SONGS);

		do {
			// Get the field values
			_id = cur.getInt(_idColumn);
			album = cur.getString(albumColumn);
			albumArt = cur.getString(albumArtColumn);
			albumKey = cur.getString(albumKeyColumn);
			artist = cur.getString(artistColumn);
			numOfSongs = cur.getInt(numOfSongsColumn);

			// Do something with the values.
			Log.i(TAG, _id + " album:" + album + " albumArt:" + albumArt
					+ "albumKey: " + albumKey + " artist: " + artist
					+ " numOfSongs: " + numOfSongs + "---");
			HashMap<String, String> hash = new HashMap<String, String>();
			hash.put("_id", _id + "");
			hash.put("album", album);
			hash.put("albumArt", albumArt);
			hash.put("albumKey", albumKey);
			hash.put("artist", artist);
			hash.put("numOfSongs", numOfSongs + "");
			albumList.add(hash);

		} while (cur.moveToNext());

	}
}
 
开发者ID:linmp4,项目名称:quickmark,代码行数:48,代码来源:AlbumHelper.java

示例14: getAlbumColumnData

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
private void getAlbumColumnData(Cursor cur) {
	if (cur.moveToFirst()) {
		int _id;
		String album;
		String albumArt;
		String albumKey;
		String artist;
		int numOfSongs;

		int _idColumn = cur.getColumnIndex(Albums._ID);
		int albumColumn = cur.getColumnIndex(Albums.ALBUM);
		int albumArtColumn = cur.getColumnIndex(Albums.ALBUM_ART);
		int albumKeyColumn = cur.getColumnIndex(Albums.ALBUM_KEY);
		int artistColumn = cur.getColumnIndex(Albums.ARTIST);
		int numOfSongsColumn = cur.getColumnIndex(Albums.NUMBER_OF_SONGS);

		do {
			// Get the field values
			_id = cur.getInt(_idColumn);
			album = cur.getString(albumColumn);
			albumArt = cur.getString(albumArtColumn);
			albumKey = cur.getString(albumKeyColumn);
			artist = cur.getString(artistColumn);
			numOfSongs = cur.getInt(numOfSongsColumn);

			// Do something with the values.
			Log.i(TAG, _id + " album:" + album + " albumArt:" + albumArt + "albumKey: " + albumKey + " artist: "
					+ artist + " numOfSongs: " + numOfSongs + "---");
			HashMap<String, String> hash = new HashMap<String, String>();
			hash.put("_id", _id + "");
			hash.put("album", album);
			hash.put("albumArt", albumArt);
			hash.put("albumKey", albumKey);
			hash.put("artist", artist);
			hash.put("numOfSongs", numOfSongs + "");
			albumList.add(hash);

		} while (cur.moveToNext());

	}
}
 
开发者ID:CodeDogandCat,项目名称:CarApp,代码行数:42,代码来源:AlbumHelper.java

示例15: onCreateLoader

import android.provider.MediaStore.Audio.Albums; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String[] projection = new String[] {
            BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
    };
    StringBuilder where = new StringBuilder();
    String sortOrder = Audio.Media.DEFAULT_SORT_ORDER;
    where.append(AudioColumns.IS_MUSIC + "=1").append(" AND " + MediaColumns.TITLE + " != ''");
    Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
    if (getArguments() != null) {
        mPlaylistId = getArguments().getLong(BaseColumns._ID);
        String mimeType = getArguments().getString(MIME_TYPE);
        if (Audio.Playlists.CONTENT_TYPE.equals(mimeType)) {
            where = new StringBuilder();
            where.append(AudioColumns.IS_MUSIC + "=1");
            where.append(" AND " + MediaColumns.TITLE + " != ''");
            switch ((int)mPlaylistId) {
                case (int)PLAYLIST_QUEUE:
                    uri = Audio.Media.EXTERNAL_CONTENT_URI;
                    long[] mNowPlaying = MusicUtils.getQueue();
                    if (mNowPlaying.length == 0)
                        return null;
                    where = new StringBuilder();
                    where.append(BaseColumns._ID + " IN (");
                    if (mNowPlaying == null || mNowPlaying.length <= 0)
                        return null;
                    for (long queue_id : mNowPlaying) {
                        where.append(queue_id + ",");
                    }
                    where.deleteCharAt(where.length() - 1);
                    where.append(")");
                    break;
                case (int)PLAYLIST_FAVORITES:
                    long favorites_id = MusicUtils.getFavoritesId(getActivity());
                    projection = new String[] {
                            Playlists.Members._ID, Playlists.Members.AUDIO_ID,
                            MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
                    };
                    uri = Playlists.Members.getContentUri(EXTERNAL, favorites_id);
                    sortOrder = Playlists.Members.DEFAULT_SORT_ORDER;
                    break;
                default:
                    if (id < 0)
                        return null;
                    projection = new String[] {
                            Playlists.Members._ID, Playlists.Members.AUDIO_ID,
                            MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST,
                            AudioColumns.DURATION
                    };

                    uri = Playlists.Members.getContentUri(EXTERNAL, mPlaylistId);
                    sortOrder = Playlists.Members.DEFAULT_SORT_ORDER;
                    break;
            }
        } else if (Audio.Genres.CONTENT_TYPE.equals(mimeType)) {
            long genreId = getArguments().getLong(BaseColumns._ID);
            uri = Genres.Members.getContentUri(EXTERNAL, genreId);
            projection = new String[] {
                    BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM,
                    AudioColumns.ARTIST
            };
            where = new StringBuilder();
            where.append(AudioColumns.IS_MUSIC + "=1").append(
                    " AND " + MediaColumns.TITLE + " != ''");
            sortOrder = Genres.Members.DEFAULT_SORT_ORDER;
        } else {
            if (Audio.Albums.CONTENT_TYPE.equals(mimeType)) {
                long albumId = getArguments().getLong(BaseColumns._ID);
                where.append(" AND " + AudioColumns.ALBUM_ID + "=" + albumId);
                sortOrder = Audio.Media.TRACK + ", " + sortOrder;
            } else if (Audio.Artists.CONTENT_TYPE.equals(mimeType)) {
                sortOrder = MediaColumns.TITLE;
                long artist_id = getArguments().getLong(BaseColumns._ID);
                where.append(" AND " + AudioColumns.ARTIST_ID + "=" + artist_id);
            }
        }
    }
    return new CursorLoader(getActivity(), uri, projection, where.toString(), null, sortOrder);
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:80,代码来源:TracksFragment.java


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