The only way to do this is with a handler as mentioned a few times
above already.
On Mar 31, 12:41 pm, Phision <[EMAIL PROTECTED]> wrote:
> I think I have the same problem. I want to update a progress bar at a
> regular interval of time. I am calling setProgress() each second but
> the progress bar will not redraw itself.
> I tried to call postInvalidate after setProgress and it works BUT only
> if I give a constant value to setProgress (for example
> setProgress(14)). When I give the value I want (which is one media
> player's position) it does not redraw itself
> I see that I shall try the approach, mentioned here - with handlers -
> but anyway is there anyone that can explain me why this happens?
> Here is my code of the timer:
>
> public class KalinTask extends TimerTask {
> private TrackProgress p;
> private MediaPlayer mp;
>
> public KalinTask(TrackProgress _p, MediaPlayer _mp){
> p = _p; mp = _mp;
> p.setProgress(5);
> }
>
> @Override
> public void run() {
> Log.e("upl", "Run: "+ p.getProgress());
> p.setProgress((mp.getCurrentPosition()*100)/mp.getDuration());
> p.postInvalidate();
> }
>
> }
>
> Regards, Kalin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---