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. What's the meaning of the $ (dollar sign) in the backtrace?

Hi all,

I wanted to understand what the $ sign and the number after a $ sign
meant in a backtrace.

For example, consider the following backtrace:

  at android.app.ActivityThread.access$2500(ActivityThread.java:115)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
1745)

In the first line, what does the number 2500 refer to? In addition, I
couldn't find the function "access" in ActivityThread.java, and line
115 is just the beginning of the class. Can anyone help clarify this?
Thanks!

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

2. code to uninstall applications

I wan't to uninstall applications using my application... I can
retrieve the list of packages installed but I don't know how to remove
them... I used the PackageManager class, getInstalledApplications()
method... I can't find any method like removeApplication() or
uninstallApplication().

the only method I saw in this class is the removePackageFromPreferred
(String packageName) method... It retrieves a list of preferred
packages.. I don't exactly know what preferred packages means or
somehow how to retrieve them... I tried to put a package name in the
method "removePackageFromPreferred (com.dev5.fivegame)" but it gives
an error...

I'm kinda new to these stuffs so pardon me for my questions...
--~--~---------~--~----~------------~-------~--~----~

3. MediaPlayer take an InputStream as input...

4. problem in drawling line on maps

5. Share resources between projects?

6. How to make device to sleep?

7. Replacing Incoming Call Screen With Custom Screen