本文整理汇总了Java中android.provider.MediaStore.Audio.AudioColumns.IS_MUSIC属性的典型用法代码示例。如果您正苦于以下问题:Java AudioColumns.IS_MUSIC属性的具体用法?Java AudioColumns.IS_MUSIC怎么用?Java AudioColumns.IS_MUSIC使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.MediaStore.Audio.AudioColumns
的用法示例。
在下文中一共展示了AudioColumns.IS_MUSIC属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: getSongListForAlbum
/**
* @param context The {@link Context} to use.
* @param id The ID of the album.
* @return The song list for an album.
*/
public static final long[] getSongListForAlbum(final Context context, final long id) {
final String[] projection = new String[]{
BaseColumns._ID
};
final String selection = AudioColumns.ALBUM_ID + "=" + id + " AND " + AudioColumns.IS_MUSIC
+ "=1";
Cursor cursor = context.getContentResolver().query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection, null,
AudioColumns.TRACK + ", " + MediaStore.Audio.Media.DEFAULT_SORT_ORDER);
if (cursor != null) {
final long[] mList = getSongListForCursor(cursor);
cursor.close();
cursor = null;
return mList;
}
return sEmptyList;
}
示例3: getSongListForGenre
/**
* @param context The {@link Context} to use.
* @param id The ID of the genre.
* @return The song list for an genre.
*/
public static final long[] getSongListForGenre(final Context context, final long id) {
final String[] projection = new String[]{
BaseColumns._ID
};
String selection = (AudioColumns.IS_MUSIC + "=1") +
" AND " + MediaColumns.TITLE + "!=''";
final Uri uri = MediaStore.Audio.Genres.Members.getContentUri("external", Long.valueOf(id));
Cursor cursor = context.getContentResolver().query(uri, projection, selection,
null, null);
if (cursor != null) {
final long[] mList = getSongListForCursor(cursor);
cursor.close();
cursor = null;
return mList;
}
return sEmptyList;
}
示例4: 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;
}
示例5: getSongListForAlbum
/**
* @param context
* @param id
* @return
*/
public static long[] getSongListForAlbum(Context context, long id) {
final String[] projection = new String[] {
BaseColumns._ID
};
String selection = AudioColumns.ALBUM_ID + "=" + id + " AND " + AudioColumns.IS_MUSIC
+ "=1";
String sortOrder = 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;
}
示例6: 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;
}
示例7: getSongListForAlbum
/**
* @param context The {@link Context} to use.
* @param id The ID of the album.
* @return The song list for an album.
*/
public static final long[] getSongListForAlbum(final Context context, final String id) {
final String[] projection = new String[] {
BaseColumns._ID
};
final String selection = AudioColumns.ALBUM_ID + "=" + id + " AND " + AudioColumns.IS_MUSIC
+ "=1";
Cursor cursor = context.getContentResolver().query(
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection, null,
AudioColumns.TRACK + ", " + MediaStore.Audio.Media.DEFAULT_SORT_ORDER);
if (cursor != null) {
final long[] mList = getSongListForCursor(cursor);
cursor.close();
cursor = null;
return mList;
}
return sEmptyList;
}
示例8: shuffleAll
/**
* Shuffle all the tracks
*/
public void shuffleAll() {
Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
String[] projection = new String[] {
BaseColumns._ID
};
String selection = AudioColumns.IS_MUSIC + "=1";
String sortOrder = "RANDOM()";
Cursor cursor = MusicUtils.query(this, uri, projection, selection, null, sortOrder);
if (cursor != null) {
MusicUtils.shuffleAll(this, cursor);
cursor.close();
cursor = null;
}
}
示例9: suffle
public static void suffle(Context context) {
Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
String[] projection = new String[] {
BaseColumns._ID
};
String selection = AudioColumns.IS_MUSIC + "=1";
String sortOrder = "RANDOM()";
Cursor cursor = MusicUtils.query(context, uri, projection, selection, null, sortOrder);
if (cursor != null) {
MusicUtils.shuffleAll(context, cursor);
cursor.close();
cursor = null;
}
}
示例10: shuffleAll
/**
* Shuffle all the tracks
*/
public void shuffleAll() {
Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
String[] projection = new String[] {
BaseColumns._ID
};
String selection = AudioColumns.IS_MUSIC + "=1";
String sortOrder = Audio.Media.DEFAULT_SORT_ORDER;
Cursor cursor = MusicUtils.query(this, uri, projection, selection, null, sortOrder);
if (cursor != null) {
MusicUtils.shuffleAll(this, cursor);
cursor.close();
cursor = null;
}
}