string - Android: How to change TextView periodically -


i'm working on shoutcast radio project. using streamscrapper library i'm able current song name , current artist. here problem. once open app, gets song name , artist name, since not update it. tried timer couldn't figure out.

and here method current song id:

private void initializemediaplayer() {      player = new aacplayer();     scraper = new shoutcastscraper();     try {         streams = scraper.scrape(new uri("http://sunucu2.radyolarburada.com:5000/"));         string str = "asd";         (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();     } } 

maybe runnable:

private handler handler = new handler();  handler.postattime(timetask, systemclock.uptimemillis() + 500);  private runnable timetask = new runnable() {     public void run() {         //do stuff here          //do again         handler.postattime(timetask, systemclock.uptimemillis() + 500);     } }; 

before leave make sure stop tasks:

handler.removecallbacksandmessages(null); 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -