首页 > 代码库 > 发送广播

发送广播

public void sendPlayStateBrocast()    
 {
  
  if (mContext != null)
  {
   Intent intent = new Intent(BROCAST_NAME);
   intent.putExtra(MusicPlayState.PLAY_STATE_NAME, mPlayState);
   intent.putExtra(MusicPlayState.PLAY_MUSIC_INDEX, mCurPlayIndex);
   
   if (mPlayState != MusicPlayState.MPS_NOFILE)
   {
    Bundle bundle = new Bundle(); 
    MusicData data = http://www.mamicode.com/mMusicFileList.get(mCurPlayIndex);
    
    bundle.putParcelable(MusicData.KEY_MUSIC_DATA, data); 
    intent.putExtra(MusicData.KEY_MUSIC_DATA, bundle);
   }
   
  
   mContext.sendBroadcast(intent);
  }
  
  
 }