[android-developers] Re: Doing something every second

2009-08-17 Thread monsoon

You could use an:  android.os.CountDownTimer
I found it works pretty much like the Timer class in Swing, if you've
dabbled with that.

Cheers
Steve

On Aug 17, 6:29 am, Rexxars  wrote:
> Hi,
>
> I'm trying to create a remote control for a media player
> (communicating with a TCP socket over Wifi).
> When it retrieves information about the current song being played, it
> gets the current position and total duration of the song.
> Obviously, what I want is a MM:SS display of the current position.
> What is the best way to achieve this?
> I could use a thread which sleeps, but that's not very accurate. What
> is the "proper" way of making it update every second?
>
> Thanks in advance!
>
> - Rexxars
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Doing something every second

2009-08-16 Thread Roman ( T-Mobile USA)

I assume that you have all the needed information about the streams
which you are going to play which means you have also the length
information of the stream. When you start the stream start also a
timer on your mobile device and run it down. If you pause the stream,
try to retrieve the actual position from your player where the stream
is stopped.

I would avoid sending any information about current  position
information over Wifi because in worse case you won't be accurate. You
should consider that your TCP connection is only from type BEST and
your Wifi channel might get congested).

--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.


On Aug 16, 1:29 pm, Rexxars  wrote:
> Hi,
>
> I'm trying to create a remote control for a media player
> (communicating with a TCP socket over Wifi).
> When it retrieves information about the current song being played, it
> gets the current position and total duration of the song.
> Obviously, what I want is a MM:SS display of the current position.
> What is the best way to achieve this?
> I could use a thread which sleeps, but that's not very accurate. What
> is the "proper" way of making it update every second?
>
> Thanks in advance!
>
> - Rexxars
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---