Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid, How to display the buffering % from onBufferingUpdate
    text
    copied!<p>I have a Media player service that plays a internet stream, but I'm having problems on how to display in my xml the buffering percentage, at the moment I'm just displaying a message since all the ways I have try it gave me a static long number. Here is the code from my player service:</p> <pre><code>@Override public void onBufferingUpdate(MediaPlayer mp, int percent) { setBufferPosition(percent * getMusicDuration() / 100); myMain.EstadoRadio.setText(" Reproductor \n Buffering... "); } </code></pre> <p>as you can tell EstadoRadio is a text view in my xml that is working from myMain activity where I want to display the buffering % of the stream. Thanks for your help.</p> <p>EDIT: I have seen inmost cases where 'percent' from the onBufferingUpdate(MediaPlayer mp, int percent) is used, something like this:</p> <pre><code>myMain.EstadoRadio.setText(" Reproductor \n" + percent + "%"); </code></pre> <p>but in my case percent is always -2147483648, I don't know why, or why it doesn't change or update, here is a little from my log cat:</p> <pre><code>05-17 13:34:37.005: V/MediaPlayer(25382): message received msg=3, ext1=-2147483648, ext2=0 05-17 13:34:37.005: V/MediaPlayer(25382): buffering -2147483648 05-17 13:34:37.005: V/MediaPlayer(25382): callback application 05-17 13:34:37.005: V/MediaPlayer(25382): getDuration 05-17 13:34:37.015: V/MediaPlayer(25382): back from callback 05-17 13:34:38.016: V/MediaPlayer(25382): message received msg=3, ext1=-2147483648, ext2=0 05-17 13:34:38.016: V/MediaPlayer(25382): buffering -2147483648 05-17 13:34:38.016: V/MediaPlayer(25382): callback application 05-17 13:34:38.016: V/MediaPlayer(25382): getDuration 05-17 13:34:38.016: V/MediaPlayer(25382): back from callback </code></pre>
 

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