我有一个小型收音机应用程序,我试图让它继续尝试重新连接/缓冲我的流而不退出...不知道我怎么能循环这个,但这是我的缓冲代码。我非常感谢你能得到的任何帮助!
public void prepare() {
/* ------Station- buffering-------- */
isPreparingStarted = true;
setStatus(STATUS_BUFFERING);
sendBroadcast(new Intent(MODE_THREE));
showNotification();
try {
if (getCurrentStationType().equals(SIGNAL_AAC))
multiPlayer.playAsync(StationURL());
else {
mediaPlayer.setDataSource(StationURL());
mediaPlayer.prepareAsync();
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
stop();
} catch (NullPointerException e) {
e.printStackTrace();
stop();
} catch (IllegalStateException e) {
e.printStackTrace();
stop();
} catch (IOException e) {
e.printStackTrace();
stop();
} catch (Exception e) {
e.printStackTrace();
stop();
}
}