Doing something every second

by Rexxars » Mon, 17 Aug 2009 04:29:52 GMT


Sponsored Links
 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

--~--~---------~--~----~------------~-------~--~----~



Doing something every second

by Roman ( T-Mobile USA) » Mon, 17 Aug 2009 13:01:30 GMT


 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.




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Doing something every second

by monsoon » Mon, 17 Aug 2009 20:47:47 GMT


 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



--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. need heelp droid jadi robot ijo

suhu-suhu,

mohon bantuannya,

droid ke wipe jadi muncul robot ijo aja minat di aktivasi,

apa yang harus dilakukan

tadi siang upgrade jadi froyo, trus malem ini mo upgrade jadi yang sudah rooted

salah di wipe data :) sekarang hilang semua


please heeelp mee

-- 
"Indonesian Android Community [id-android]" 

2. How to store questions for quiz type application

I don't see how your problem is any different on Android than it would
be for any program in any language on any device. Pick a data
structure. Don't optimize it (yet).

-- 

3. License Verification Library: getting error NOT_MARKET_MANAGED

4. what is the difference between notifyDataSetChanged() and notifyDataSetInvalidated() ?

5. Problem with reading contacts on Samsung Galaxy Europa

6. Get around the inability to alias columns coming from ContactsContract in 2.2

7. HTC EVO RTSP issues... Anyone experience issues in this area?