Note that there are some explanatory texts on larger screens.

plurals
  1. POTextView widget not updating on android2.2
    text
    copied!<p>I made a media player that streams through shoutcast and I was trying to get the song title off that stream. I have successfully got the song title and made this display on a textview and I update it when the song changes.</p> <p>I have tested this code with android emulator, using android 1.5 and android 2.1. The code works but when I tested it on android 2.2 the text is not updating.</p> <p>Any ideas why it is not updating? The code I used to update the textview is below.</p> <p>when i click on the button in my layout pageArtist() and pageTitle() will be called and they will get the song title and artist and change the text of the textview every 4seconds </p> <p>MY CODE IN MY ONCREATE()</p> <pre><code>public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); streamButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { pageArtist(); pageTitle(); } </code></pre> <p>HERE'S MY METHOD FOR UPDATING MY TEXTVIEW</p> <pre><code> private void pageTitle(){ timer = new Timer(); timer.schedule(new TimerTask() { public void run() { URL url; try { url = new URL("http://teststream.com:8000/listen.mp3"); IcyStreamMeta icy = new IcyStreamMeta(url); TextView title1 = (TextView) findViewById(R.id.song_title); String T; T = icy.getTitle(); title1.setText(T); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); }catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }, 2, 4000); } </code></pre> <p><strong>EDIT</strong>: THIS CODE GETS REPEATED EVERY 4 SECOND WITH TIMER</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload