• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ArtistColumns类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getIdForArtist

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
 * Returns the Id for an artist.
 *
 * @param context The {@link Context} to use.
 * @param name    The name of the artist.
 * @return The ID for an artist.
 */
public static final long getIdForArtist(final Context context, final String name) {
    Cursor cursor = context.getContentResolver().query(
            MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI, new String[]{
                    BaseColumns._ID
            }, ArtistColumns.ARTIST + "=?", new String[]{
                    name
            }, ArtistColumns.ARTIST);
    int id = -1;
    if (cursor != null) {
        cursor.moveToFirst();
        if (!cursor.isAfterLast()) {
            id = cursor.getInt(0);
        }
        cursor.close();
        cursor = null;
    }
    return id;
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:26,代码来源:MusicUtils.java


示例2: doSearch

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
 * Create a Search Chooser
 */
public static void doSearch(Context mContext, Cursor mCursor, String Type) {
    CharSequence title = null;
    Intent i = new Intent();
    i.setAction(MediaStore.INTENT_ACTION_MEDIA_SEARCH);
    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    String query = "";

	if ( Type == TYPE_ALBUM ){
		query = mCursor.getString(mCursor.getColumnIndexOrThrow(AlbumColumns.ALBUM));
	}
	else if( Type == TYPE_ARTIST ){
		query = mCursor.getString(mCursor.getColumnIndexOrThrow(ArtistColumns.ARTIST));
	}
	else if( Type == TYPE_GENRE ||  Type == TYPE_PLAYLIST ||  Type == TYPE_SONG ){
		query = mCursor.getString(mCursor.getColumnIndexOrThrow(MediaColumns.TITLE));
	}
    title = "";
    i.putExtra("", query);
    title = title + " " + query;
    title = "Search " + title;
    i.putExtra(SearchManager.QUERY, query);
    mContext.startActivity(Intent.createChooser(i, title));
}
 
开发者ID:cpoopc,项目名称:com.cp.monsterMod,代码行数:27,代码来源:MusicUtils.java


示例3: getIdForArtist

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
 * Returns the Id for an artist.
 *
 * @param context The {@link Context} to use.
 * @param name The name of the artist.
 * @return The ID for an artist.
 */
public static long getIdForArtist(final Context context, final String name) {
    Cursor cursor = context.getContentResolver().query(
            MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI, new String[] {
                BaseColumns._ID
            }, ArtistColumns.ARTIST + "=?", new String[] {
                name
            }, ArtistColumns.ARTIST);
    int id = -1;
    if (cursor != null) {
        cursor.moveToFirst();
        if (!cursor.isAfterLast()) {
            id = cursor.getInt(0);
        }
        cursor.close();
        cursor = null;
    }
    return id;
}
 
开发者ID:OpenSilk,项目名称:Orpheus,代码行数:26,代码来源:MusicUtils.java


示例4: getIdForArtist

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
 * Returns the Id for an artist.
 * 
 * @param context The {@link Context} to use.
 * @param name The name of the artist.
 * @return The ID for an artist.
 */
public static final long getIdForArtist(final Context context, final String name) {
    Cursor cursor = context.getContentResolver().query(
            MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI, new String[] {
                BaseColumns._ID
            }, ArtistColumns.ARTIST + "=?", new String[] {
                name
            }, ArtistColumns.ARTIST);
    int id = -1;
    if (cursor != null) {
        cursor.moveToFirst();
        if (!cursor.isAfterLast()) {
            id = cursor.getInt(0);
        }
        cursor.close();
        cursor = null;
    }
    return id;
}
 
开发者ID:micromacer,项目名称:Player-by-TweekProject,代码行数:26,代码来源:MusicUtils.java


示例5: setHeaderLayout

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
 * @return A custom ContextMenu header
 */
public static  View setHeaderLayout(String Type, Cursor cursor, Activity activity) {
    LayoutInflater inflater = activity.getLayoutInflater();
    View header = inflater.inflate(R.layout.music_context_menu_header, null, false);

    // Artist image
    final ImageView mHanderImage = (ImageView)header.findViewById(R.id.header_image);
    String albumId="",artistName="",albumName="";

    if(Type == TYPE_ALBUM){
        albumName = cursor.getString(cursor.getColumnIndexOrThrow(AlbumColumns.ALBUM));
        artistName = cursor.getString(cursor.getColumnIndexOrThrow(AlbumColumns.ARTIST));
        albumId = cursor.getString(cursor.getColumnIndexOrThrow(BaseColumns._ID));
    }
    else{
        artistName = cursor.getString(cursor.getColumnIndexOrThrow(ArtistColumns.ARTIST));
    }
    
    
    ImageInfo mInfo = new ImageInfo();
    mInfo.type = Type;
    mInfo.size = SIZE_THUMB;
    mInfo.source = SRC_FIRST_AVAILABLE;
    mInfo.data = (Type == TYPE_ALBUM ? new String[]{ albumId , artistName, albumName } : new String[]{ artistName});
   
    ImageProvider.getInstance(activity).loadImage( mHanderImage, mInfo );

    // Set artist name
    TextView headerText = (TextView)header.findViewById(R.id.header_text);
    headerText.setText( (Type == TYPE_ALBUM ? albumName : artistName));
    headerText.setBackgroundColor((activity).getResources().getColor(R.color.transparent_black));
    return header;
}
 
开发者ID:hubcarl,项目名称:mobile-manager-tool,代码行数:36,代码来源:ApolloUtils.java


示例6: getNumSongs

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
  * @return number of albums from Bundle
  */
 public String getNumSongs() {
 	String[] projection = {
             BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_TRACKS
     };
 	Uri uri = Audio.Artists.EXTERNAL_CONTENT_URI;
     Long id = ApolloUtils.getArtistId(getArtist(), ARTIST_ID, this);
     Cursor cursor = null;
     try{
     	cursor = this.getContentResolver().query(uri, projection, BaseColumns._ID+ "=" + DatabaseUtils.sqlEscapeString(String.valueOf(id)), null, null);
     }
     catch(Exception e){
     	e.printStackTrace();
     }
     if(cursor == null)
     	return String.valueOf(0);
     int mArtistNumAlbumsIndex = cursor.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_TRACKS);
     if(cursor.getCount()>0){
  	cursor.moveToFirst();
      String numAlbums = cursor.getString(mArtistNumAlbumsIndex);
cursor.close();
      if(numAlbums != null){
      	return numAlbums;
      }
     }
     return String.valueOf(0);
 }
 
开发者ID:hubcarl,项目名称:mobile-manager-tool,代码行数:30,代码来源:TracksBrowser.java


示例7: getNumAlbums

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
  * @return number of albums from Bundle
  */
 public String getNumAlbums() {
     if (bundle.getString(NUMALBUMS) != null)
         return bundle.getString(NUMALBUMS);
     String[] projection = {
             BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_ALBUMS
     };
     Uri uri = Audio.Artists.EXTERNAL_CONTENT_URI;
     Long id = ApolloUtils.getArtistId(getArtist(), ARTIST_ID, this);
     Cursor cursor = null;
     try{
     	cursor = this.getContentResolver().query(uri, projection, BaseColumns._ID+ "=" + DatabaseUtils.sqlEscapeString(String.valueOf(id)), null, null);
     }
     catch(Exception e){
     	e.printStackTrace();
     }
     if(cursor == null)
     	return String.valueOf(0);
     int mArtistNumAlbumsIndex = cursor.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_ALBUMS);
     if(cursor.getCount()>0){
  	cursor.moveToFirst();
      String numAlbums = cursor.getString(mArtistNumAlbumsIndex);
cursor.close();
      if(numAlbums != null){
      	return numAlbums;
      }
     }
     return String.valueOf(0);
 }
 
开发者ID:hubcarl,项目名称:mobile-manager-tool,代码行数:32,代码来源:TracksBrowser.java


示例8: setupFragmentData

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
public void setupFragmentData(){
	mAdapter = new ArtistAdapter(getActivity(), R.layout.music_gridview_items, null,
									new String[] {}, new int[] {}, 0); 
	mProjection = new String []{
            BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_ALBUMS
    };
    mUri = Audio.Artists.EXTERNAL_CONTENT_URI;
    mSortOrder = Audio.Artists.DEFAULT_SORT_ORDER;
    mFragmentGroupId = 1;
    mType = TYPE_ARTIST;
}
 
开发者ID:hubcarl,项目名称:mobile-manager-tool,代码行数:12,代码来源:ArtistsFragment.java


示例9: setupViewData

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
public void setupViewData(Cursor mCursor){

    	mLineOneText = mCursor.getString(mCursor.getColumnIndexOrThrow(ArtistColumns.ARTIST));
        int albums_plural = mCursor.getInt(mCursor.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_ALBUMS));
        boolean unknown = mLineOneText == null || mLineOneText.equals(MediaStore.UNKNOWN_STRING);
        mLineTwoText = MusicUtils.makeAlbumsLabel(mContext, albums_plural, 0, unknown);        
        mGridType = TYPE_ARTIST;        
        mImageData = new String[]{mLineOneText};
        mPlayingId = MusicUtils.getCurrentArtistId();
        mCurrentId = mCursor.getLong(mCursor.getColumnIndexOrThrow(BaseColumns._ID));
        
    }
 
开发者ID:hubcarl,项目名称:mobile-manager-tool,代码行数:13,代码来源:ArtistAdapter.java


示例10: onItemClick

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的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


示例11: setHeaderLayout

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
 * @return A custom ContextMenu header
 */
public static  View setHeaderLayout(String Type, Cursor cursor, Activity activity) {
    LayoutInflater inflater = activity.getLayoutInflater();
    View header = inflater.inflate(R.layout.context_menu_header, null, false);

    // Artist image
    final ImageView mHanderImage = (ImageView)header.findViewById(R.id.header_image);
    String albumId="",artistName="",albumName="";

    if(Type == TYPE_ALBUM){
        albumName = cursor.getString(cursor.getColumnIndexOrThrow(AlbumColumns.ALBUM));
        artistName = cursor.getString(cursor.getColumnIndexOrThrow(AlbumColumns.ARTIST));
        albumId = cursor.getString(cursor.getColumnIndexOrThrow(BaseColumns._ID));
    }
    else{
        artistName = cursor.getString(cursor.getColumnIndexOrThrow(ArtistColumns.ARTIST));
    }
    
    
    ImageInfo mInfo = new ImageInfo();
    mInfo.type = Type;
    mInfo.size = SIZE_THUMB;
    mInfo.source = SRC_FIRST_AVAILABLE;
    mInfo.data = (Type == TYPE_ALBUM ? new String[]{ albumId , artistName, albumName } : new String[]{ artistName});
   
    ImageProvider.getInstance(activity).loadImage( mHanderImage, mInfo );

    // Set artist name
    TextView headerText = (TextView)header.findViewById(R.id.header_text);
    headerText.setText( (Type == TYPE_ALBUM ? albumName : artistName));
    headerText.setBackgroundColor((activity).getResources().getColor(R.color.transparent_black));
    return header;
}
 
开发者ID:cpoopc,项目名称:com.cp.monsterMod,代码行数:36,代码来源:ApolloUtils.java


示例12: getArtistName

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
public static String getArtistName(Context mContext, long artist_id, boolean default_name) {
    String where = BaseColumns._ID + "=" + artist_id;
    String[] cols = new String[] {
        ArtistColumns.ARTIST
    };
    Uri uri = Audio.Artists.EXTERNAL_CONTENT_URI;
    Cursor cursor = mContext.getContentResolver().query(uri, cols, where, null, null);
    if (cursor == null){
        return MediaStore.UNKNOWN_STRING;
    }
    if (cursor.getCount() <= 0) {
        if (default_name)
            return mContext.getString(R.string.unknown);
        else
            return MediaStore.UNKNOWN_STRING;
    } else {
        cursor.moveToFirst();
        String name = cursor.getString(0);
        cursor.close();
        if (name == null || MediaStore.UNKNOWN_STRING.equals(name)) {
            if (default_name)
                return mContext.getString(R.string.unknown);
            else
                return MediaStore.UNKNOWN_STRING;
        }
        return name;
    }
}
 
开发者ID:cpoopc,项目名称:com.cp.monsterMod,代码行数:29,代码来源:MusicUtils.java


示例13: getNumSongs

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
  * @return number of albums from Bundle
  */
 public String getNumSongs() {
 	String[] projection = {
             BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_TRACKS
     };
 	Uri uri = Audio.Artists.EXTERNAL_CONTENT_URI;        
     Long id = ApolloUtils.getArtistId(getArtist(), ARTIST_ID, this);
     Cursor cursor = null;
     try{
     	cursor = this.getContentResolver().query(uri, projection, BaseColumns._ID+ "=" + DatabaseUtils.sqlEscapeString(String.valueOf(id)), null, null);
     }
     catch(Exception e){
     	e.printStackTrace();        	
     }
     if(cursor == null)
     	return String.valueOf(0);
     int mArtistNumAlbumsIndex = cursor.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_TRACKS);
     if(cursor.getCount()>0){
  	cursor.moveToFirst();
      String numAlbums = cursor.getString(mArtistNumAlbumsIndex);	
cursor.close();
      if(numAlbums != null){
      	return numAlbums;
      }
     }        
     return String.valueOf(0);
 }
 
开发者ID:cpoopc,项目名称:com.cp.monsterMod,代码行数:30,代码来源:TracksBrowser.java


示例14: getNumAlbums

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
  * @return number of albums from Bundle
  */
 public String getNumAlbums() {
     if (bundle.getString(NUMALBUMS) != null)
         return bundle.getString(NUMALBUMS);
     String[] projection = {
             BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_ALBUMS
     };
     Uri uri = Audio.Artists.EXTERNAL_CONTENT_URI;        
     Long id = ApolloUtils.getArtistId(getArtist(), ARTIST_ID, this);
     Cursor cursor = null;
     try{
     	cursor = this.getContentResolver().query(uri, projection, BaseColumns._ID+ "=" + DatabaseUtils.sqlEscapeString(String.valueOf(id)), null, null);
     }
     catch(Exception e){
     	e.printStackTrace();        	
     }
     if(cursor == null)
     	return String.valueOf(0);
     int mArtistNumAlbumsIndex = cursor.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_ALBUMS);
     if(cursor.getCount()>0){
  	cursor.moveToFirst();
      String numAlbums = cursor.getString(mArtistNumAlbumsIndex);	
cursor.close();
      if(numAlbums != null){
      	return numAlbums;
      }
     }        
     return String.valueOf(0);
 }
 
开发者ID:cpoopc,项目名称:com.cp.monsterMod,代码行数:32,代码来源:TracksBrowser.java


示例15: setupFragmentData

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
public void setupFragmentData(){
	mAdapter = new ArtistAdapter(getActivity(), R.layout.gridview_items, null, 
									new String[] {}, new int[] {}, 0); 
	mProjection = new String []{
            BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_ALBUMS
    };
    mUri = Audio.Artists.EXTERNAL_CONTENT_URI;
    mSortOrder = Audio.Artists.DEFAULT_SORT_ORDER;
    mFragmentGroupId = 1;
    mType = TYPE_ARTIST;
}
 
开发者ID:cpoopc,项目名称:com.cp.monsterMod,代码行数:12,代码来源:ArtistsFragment.java


示例16: getNumAlbums

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
 * @return number of albums from Bundle
 */
public String getNumAlbums() {
    if (bundle.getString(NUMALBUMS) != null)
        return bundle.getString(NUMALBUMS);
    String[] projection = {
            BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_ALBUMS
    };
    Uri uri = Audio.Artists.EXTERNAL_CONTENT_URI;        
    Long id = ApolloUtils.getArtistId(getArtist(), ARTIST_ID, this);
    Cursor cursor = null;
    try{
    	cursor = this.getContentResolver().query(uri, projection, BaseColumns._ID+ "=" + DatabaseUtils.sqlEscapeString(String.valueOf(id)), null, null);
    }
    catch(Exception e){
    	e.printStackTrace();        	
    }
    if(cursor == null)
    	return String.valueOf(0);
    int mArtistNumAlbumsIndex = cursor.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_ALBUMS);
    if(cursor.getCount()>0){
 	cursor.moveToFirst();
     String numAlbums = cursor.getString(mArtistNumAlbumsIndex);	  
     if(numAlbums != null){
     	return numAlbums;
     }
    }        
    return String.valueOf(0);
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:31,代码来源:TracksBrowser.java


示例17: onCreateLoader

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String[] projection = {
            BaseColumns._ID, ArtistColumns.ARTIST, ArtistColumns.NUMBER_OF_ALBUMS
    };
    Uri uri = Audio.Artists.EXTERNAL_CONTENT_URI;
    String sortOrder = Audio.Artists.DEFAULT_SORT_ORDER;
    return new CursorLoader(getActivity(), uri, projection, null, null, sortOrder);
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:10,代码来源:ArtistsFragment.java


示例18: onLoadFinished

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
    // Check for database errors
    if (data == null) {
        return;
    }

    mArtistIdIndex = data.getColumnIndexOrThrow(BaseColumns._ID);
    mArtistNameIndex = data.getColumnIndexOrThrow(ArtistColumns.ARTIST);
    mArtistNumAlbumsIndex = data.getColumnIndexOrThrow(ArtistColumns.NUMBER_OF_ALBUMS);
    mArtistAdapter.changeCursor(data);
    mCursor = data;
}
 
开发者ID:liufeiit,项目名称:itmarry,代码行数:14,代码来源:ArtistsFragment.java


示例19: makeArtistCursor

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
/**
 * Creates the {@link Cursor} used to run the query.
 * 
 * @param context The {@link Context} to use.
 * @return The {@link Cursor} used to run the artist query.
 */
public static final Cursor makeArtistCursor(final Context context) {
    return context.getContentResolver().query(MediaStore.Audio.Artists.EXTERNAL_CONTENT_URI,
            new String[] {
                    /* 0 */
                    BaseColumns._ID,
                    /* 1 */
                    ArtistColumns.ARTIST,
                    /* 2 */
                    ArtistColumns.NUMBER_OF_ALBUMS,
                    /* 3 */
                    ArtistColumns.NUMBER_OF_TRACKS
            }, null, null, PreferenceUtils.getInstace(context).getArtistSortOrder());
}
 
开发者ID:micromacer,项目名称:Player-by-TweekProject,代码行数:20,代码来源:ArtistLoader.java


示例20: query

import android.provider.MediaStore.Audio.ArtistColumns; //导入依赖的package包/类
public void query(Uri contentUri, String selection) {
  super.query(contentUri, ArtistColumns.ARTIST_KEY, selection, R.layout.media_picker_row, artistsColumns, artistsResIDs);
}
 
开发者ID:CarloRodriguez,项目名称:AlarmOn,代码行数:4,代码来源:MediaArtistsView.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PreparedBatch类代码示例发布时间:2022-05-22
下一篇:
Java JSONException类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap