Android のバックグラウンドで MP3 ストリームの再生を開始するサービスがあります。チャンネルを選択するメニュー アクティビティと、ボタン クリックで選択した MP3 の再生を開始するプレーヤー アクティビティがあります。MediaPlayer クラスを使用します。URL の開始方法は次のとおりです。
mp3Service.playSong(getBaseContext(),url);
さて、URL のメニューに戻ってきたら、再生中の URL を変更したいと思います。サービスを停止せず、URL のみを変更したいと思います。出来ますか?MediaPlayer のドキュメントを読みましたが、何をすべきかわからないため、いくつかのバリアントを試しました。
別の URL に切り替える方法は? mp3Service.pauseSong(getBaseContext());
次に停止し、mp3Service.playSong(getBaseContext(),newurl)?
////////////////////////////// PART OF THE CLASS
 public String currenturl="";
public void playSong(Context c, String url) {
        if (currenturl.equals(""))
        {
        if(!created){
            this.mplayer = MediaPlayer.create(c, Uri.parse(url));
            created = true;
            currenturl=url;
        }
            this.mplayer.start();
        }
        else
            {
            if (!currenturl.equals(url))
            {
                if(!created){
                    this.mplayer.stop();
                    this.mplayer = MediaPlayer.create(c, Uri.parse(url));
                    created = true;
                    currenturl=url;
                }
                    this.mplayer.start();
            }
            };
    }
public void pauseSong(Context c) {
        this.mplayer.pause();
    }
    //
    public void stopSong(Context c) {
        this.mplayer.stop();
    } 
それほど簡単ではありません...