2 番目の質問については、解決策があります。2 つの方法があります。
あなたが言っているように、再生/一時停止のメディア コントロールを示す 1 つのアクティビティを作成します。また、それぞれのサービスは引き続きバックグラウンドで再生されます。
2 番目の方法は、再生中のアクティビティでmediaplayer オブジェクトを初期化できることです。タスク マネージャーから強制終了されない限り、mediaplayer がバックグラウンドで再生し続けることを心配しないでください。(アクティビティを終了しても、 mediaplayerは引き続き音楽を再生します)
2番目の方法では、選択と再生アクティビティの両方をSingleInstanceにします
static MediaPlayer mediaplayer;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.radio_play_layout);
//here check for one thing, **mediaplayer is null or not**. If mediaplayer is null than ur activity is **starting** and u need to have data from selection activity that i need to play this station & If your mediaplayer is not null than you are coming from **notification or widget** , put some IntExtra with pendingIntent to verify that you are actually starting activity from notification or widget.
if(mediaplayer!=null && (getIntent.getIntExtra("verifier",0)==786)){
//show ur currently playing stations details and control butttons.becaz activity is started from notification or widget.
}else{
//Initialize your mediaplayer , setlayout & startplaying
}
}