本文整理汇总了Java中android.provider.MediaStore.MediaColumns.TITLE属性的典型用法代码示例。如果您正苦于以下问题:Java MediaColumns.TITLE属性的具体用法?Java MediaColumns.TITLE怎么用?Java MediaColumns.TITLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.provider.MediaStore.MediaColumns
的用法示例。
在下文中一共展示了MediaColumns.TITLE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: onCreateLoader
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
String[] projection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST,
};
StringBuilder selection = new StringBuilder();
Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
String sortOrder = Audio.Media.DEFAULT_SORT_ORDER;
uri = Audio.Media.EXTERNAL_CONTENT_URI;
long[] mNowPlaying = MusicUtils.getQueue();
if (mNowPlaying.length == 0)
return null;
selection = new StringBuilder();
selection.append(BaseColumns._ID + " IN (");
if (mNowPlaying == null || mNowPlaying.length <= 0)
return null;
for (long queue_id : mNowPlaying) {
selection.append(queue_id + ",");
}
selection.deleteCharAt(selection.length() - 1);
selection.append(")");
return new AddIdCursorLoader(getActivity(), uri, projection, selection.toString(), null,
sortOrder);
}
示例3: reloadQueueCursor
/**
* Reload the queue after we remove a track
*/
private void reloadQueueCursor() {
String[] projection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST,
};
StringBuilder selection = new StringBuilder();
Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
String sortOrder = Audio.Media.DEFAULT_SORT_ORDER;
uri = Audio.Media.EXTERNAL_CONTENT_URI;
long[] mNowPlaying = MusicUtils.getQueue();
if (mNowPlaying.length == 0)
return;
selection = new StringBuilder();
selection.append(BaseColumns._ID + " IN (");
if (mNowPlaying == null || mNowPlaying.length <= 0)
return;
for (long queue_id : mNowPlaying) {
selection.append(queue_id + ",");
}
selection.deleteCharAt(selection.length() - 1);
selection.append(")");
mCursor = MusicUtils.query(getActivity(), uri, projection, selection.toString(), null,
sortOrder);
mQuickQueueAdapter.changeCursor(mCursor);
}
示例4: setupFragmentData
@Override
public void setupFragmentData() {
mAdapter = new AlbumListAdapter(getActivity(), R.layout.music_listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1")
.append(" AND " + MediaColumns.TITLE + " != ''");
long albumId = getArguments().getLong(BaseColumns._ID);
where.append(" AND " + AudioColumns.ALBUM_ID + "=" + albumId);
mWhere = where.toString();
mSortOrder = Audio.Media.TRACK + ", " + Audio.Media.DEFAULT_SORT_ORDER;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mFragmentGroupId = 89;
mType = TYPE_ALBUM;
mTitleColumn = MediaColumns.TITLE;
}
示例5: setupFragmentData
public void setupFragmentData(){
mAdapter = new RecentlyAddedAdapter(getActivity(), R.layout.music_listview_items,
null, new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
int X = MusicUtils.getIntPref(getActivity(), NUMWEEKS, 5) * 3600 * 24 * 7;
where.append(MediaColumns.TITLE + " != ''");
where.append(" AND " + AudioColumns.IS_MUSIC + "=1");
where.append(" AND " + MediaColumns.DATE_ADDED + ">"
+ (System.currentTimeMillis() / 1000 - X));
mWhere = where.toString();
mSortOrder = MediaColumns.DATE_ADDED + " DESC";
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mTitleColumn = MediaColumns.TITLE;
}
示例6: onLoadFinished
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (data == null) {
return;
}
long[] mNowPlaying = MusicUtils.getQueue();
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++){
data.moveToPosition(-1);
while (data.moveToNext()) {
long audioid = data.getLong(data.getColumnIndexOrThrow(BaseColumns._ID));
if( audioid == mNowPlaying[i]) {
String trackName = data.getString(data.getColumnIndexOrThrow(MediaColumns.TITLE));
String artistName = data.getString(data.getColumnIndexOrThrow(AudioColumns.ARTIST));
String albumName = data.getString(data.getColumnIndexOrThrow(AudioColumns.ALBUM));
playlistCursor.addRow(new Object[] {audioid, trackName, artistName, albumName });
}
}
}
data.close();
mCursor = playlistCursor;
super.onLoadFinished(loader, playlistCursor);
}
示例7: setupFragmentData
public void setupFragmentData(){
mAdapter = new GenreListAdapter(getActivity(), R.layout.music_listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM,
AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1").append(
" AND " + MediaColumns.TITLE + " != ''");
mWhere = where.toString();
mSortOrder = Genres.Members.DEFAULT_SORT_ORDER;
mUri = Genres.Members.getContentUri(EXTERNAL, getArguments().getLong(BaseColumns._ID));
mFragmentGroupId = 3;
mType = TYPE_GENRE;
mTitleColumn = MediaColumns.TITLE;
}
示例8: setupFragmentData
@Override
public void setupFragmentData(){
mAdapter = new ArtistListAdapter(getActivity(), R.layout.music_listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1")
.append(" AND " + MediaColumns.TITLE + " != ''");
long artist_id = getArguments().getLong(BaseColumns._ID);
where.append(" AND " + AudioColumns.ARTIST_ID + "=" + artist_id);
mWhere = where.toString();
mSortOrder = MediaColumns.TITLE;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mFragmentGroupId = 88;
mType = TYPE_ARTIST;
mTitleColumn = MediaColumns.TITLE;
}
示例9: setupFragmentData
@Override
public void setupFragmentData(){
mAdapter = new ArtistListAdapter(getActivity(), R.layout.listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1")
.append(" AND " + MediaColumns.TITLE + " != ''");
long artist_id = getArguments().getLong(BaseColumns._ID);
where.append(" AND " + AudioColumns.ARTIST_ID + "=" + artist_id);
mWhere = where.toString();
mSortOrder = MediaColumns.TITLE;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mFragmentGroupId = 88;
mType = TYPE_ARTIST;
mTitleColumn = MediaColumns.TITLE;
}
示例10: setupFragmentData
@Override
public void setupFragmentData() {
mAdapter = new AlbumListAdapter(getActivity(), R.layout.listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1")
.append(" AND " + MediaColumns.TITLE + " != ''");
long albumId = getArguments().getLong(BaseColumns._ID);
where.append(" AND " + AudioColumns.ALBUM_ID + "=" + albumId);
mWhere = where.toString();
mSortOrder = Audio.Media.TRACK + ", " + Audio.Media.DEFAULT_SORT_ORDER;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mFragmentGroupId = 89;
mType = TYPE_ALBUM;
mTitleColumn = MediaColumns.TITLE;
}
示例11: setupFragmentData
public void setupFragmentData(){
mAdapter = new RecentlyAddedAdapter(getActivity(), R.layout.listview_items,
null, new String[] {}, new int[] {}, 0);
//构造查询语句,父类中回调,给cursorloader使用
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
int X = MusicUtils.getIntPref(getActivity(), NUMWEEKS, 5) * 3600 * 24 * 7;
where.append(MediaColumns.TITLE + " != ''");
where.append(" AND " + AudioColumns.IS_MUSIC + "=1");
where.append(" AND " + MediaColumns.DATE_ADDED + ">"
+ (System.currentTimeMillis() / 1000 - X));
mWhere = where.toString();
mSortOrder = MediaColumns.DATE_ADDED + " DESC";
//查询音乐的uri?
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mTitleColumn = MediaColumns.TITLE;
}
示例12: setupFragmentData
public void setupFragmentData(){
mAdapter = new SonglistAdapter(getActivity(), R.layout.listview_items, null,
new String[] {}, new int[] {}, 0);
mProjection = new String[] {
BaseColumns._ID, MediaColumns.TITLE, AudioColumns.ALBUM, AudioColumns.ARTIST
};
StringBuilder where = new StringBuilder();
where.append(AudioColumns.IS_MUSIC + "=1").append(" AND " + MediaColumns.TITLE + " != ''");
mWhere = where.toString();
mSortOrder = Audio.Media.DEFAULT_SORT_ORDER;
mUri = Audio.Media.EXTERNAL_CONTENT_URI;
mFragmentGroupId = 3;
mType = TYPE_SONG;
mTitleColumn = MediaColumns.TITLE;
View shuffle_temp = View.inflate(getActivity(), R.layout.shuffle_all, null);
mListView.addHeaderView(shuffle_temp);
RelativeLayout shuffle = (RelativeLayout)shuffle_temp.findViewById(R.id.shuffle_wrapper);
shuffle.setVisibility(View.VISIBLE);
shuffle.setOnClickListener(new RelativeLayout.OnClickListener() {
public void onClick(View v)
{
MusicUtils.suffle(getActivity());
}
});
}
示例13: onCreateLoader
@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 = MediaColumns.DATE_ADDED + " DESC";
Uri uri = Audio.Media.EXTERNAL_CONTENT_URI;
int X = MusicUtils.getIntPref(getActivity(), NUMWEEKS, 5) * 3600 * 24 * 7;
where = new StringBuilder();
where.append(MediaColumns.TITLE + " != ''");
where.append(" AND " + AudioColumns.IS_MUSIC + "=1");
where.append(" AND " + MediaColumns.DATE_ADDED + ">"
+ (System.currentTimeMillis() / 1000 - X));
return new AddIdCursorLoader(getActivity(), uri, projection, where.toString(), null, sortOrder);
//return new RecentlyAddedLoader(getActivity());
}
示例14: setRingtone
/**
* @param context The {@link Context} to use
* @param id The song ID.
*/
public static void setRingtone(final Context context, final long id) {
final ContentResolver resolver = context.getContentResolver();
final Uri uri = ContentUris.withAppendedId(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, id);
try {
final ContentValues values = new ContentValues(2);
values.put(AudioColumns.IS_RINGTONE, "1");
values.put(AudioColumns.IS_ALARM, "1");
resolver.update(uri, values, null, null);
} catch (final UnsupportedOperationException ingored) {
return;
}
final String[] projection = new String[]{
BaseColumns._ID, MediaColumns.DATA, MediaColumns.TITLE
};
final String selection = BaseColumns._ID + "=" + id;
Cursor cursor = resolver.query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection,
selection, null, null);
try {
if (cursor != null && cursor.getCount() == 1) {
cursor.moveToFirst();
Settings.System.putString(resolver, Settings.System.RINGTONE, uri.toString());
final String message = context.getString(R.string.set_as_ringtone,
cursor.getString(2));
Toast.makeText((Activity) context, message, Toast.LENGTH_SHORT).show();
}
} finally {
if (cursor != null) {
cursor.close();
cursor = null;
}
}
}
示例15: MediaQuery
public MediaQuery(long album_id) {
query = Audio.Media.EXTERNAL_CONTENT_URI;
selection = Audio.AudioColumns.ALBUM_ID + " == " + album_id;
sort = Audio.AudioColumns.TRACK;
display = MediaColumns.TITLE;
entries = null;
}