저는 최근에 ShoutCast 라디오 프로젝트에서 작업하고 있습니다. streamscrapper 라이브러리를 사용하여 현재 노래 이름과 현재 아티스트를 가져올 수 있습니다. 여기에 문제가있다. 일단 앱을 열면 노래 이름과 아티스트 이름이 표시되지만 이후에는 업데이트되지 않습니다. 타이머로 해보려고했지만 알아 내지 못했습니다. 여기 Android : 주기적으로 TextView를 변경하는 방법
그리고
내가 현재 곡 ID를 얻는 방법 :private void initializeMediaPlayer() {
player = new AACPlayer();
scraper = new ShoutCastScraper();
try {
streams = scraper.scrape(new URI("http://sunucu2.radyolarburada.com:5000/"));
String str = "asd";
for (Stream stream: streams) {
str = stream.getCurrentSong();
currPlayView.setText("Now Playing: " + str);
}
} catch (ScrapeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
핸들러 또는 타이머 개념을 사용합니다. 필요한 시간 간격을 수정하십시오. –