Dear all,

I have solved my problem, so the issue below is no logner relevant

Thank you for all the great input I have got in this forum

best regards
CKLOCH

On 22 Jun., 11:25, ckloch <htc.kl...@hotmail.com> wrote:
> Dear all,
>
> I have developed a small app that helps the driver to regulate his
> speed in order to pass the traffic light when it is green; and thereby
> minimizing the number of times that he has to stop for red.
>
> But, the app does not always work as anticipated.
> In my app, I need to get the timedifference from when he starts
> driving to the actual time.
> This time is needed in order to calculate whether he will reach the
> light when it is green, or if he needs to slow down in case the
> current speed is too high.
>
> I will appreciate any help that can guide me in the right direction to
> identify the problem: is it due to Java and that it cannot control the
> on-going queueing of GPS data? is it due to problems with HTC Hero and
> Android 1.5; or is it something much more simple that causes my
> problem. Please, send me your input.
> I have inserted the most relevant parts of the code below which is
> structurized as:
>
> 1) gpspos() is the function called when I want to start the routine
> (the main app is launched before).
>
> 2) initial_time should contain the timesample from when I call the
> routine. That is the reason why I set it to zero in the beginning and
> then update it the first time the conditions  distance_1< radius and
> counter_L are fulfilled. These conditions are fulfilled when I call
> gpspos().
>
> 3) time=location.getTime() is the GPS clock.
>
> 4) double spend_time_1_sec = (time - initial_time); determines the
> time spend since I called gpspos().
>
> Thank you for your time and helpCKLOCH
>
> public void gpspos() {
> super.onResume();
>
> LocationManager locMgr = (LocationManager)
> getSystemService(Context.LOCATION_SERVICE);
>                 LocationListener locListener = new LocationListener()
>                 {
>
>                 double initial_time = 0;
>
>                 public void    onLocationChanged(Location location)
>                 {
>
>                     if (location != null)
>                             {
>                             double time = location.getTime()/1000;
>                             double spend_time_1_sec = (time -
> initial_time);
>
>                                 if (distance_1<radius &&
> counter_L==1)  // This is only true once when the routine gpspos() is
> called
>                         {
>                         initial_time = location.getTime()/1000; //
> initial_time is in seconds
>                         }
>                             }
>                 }
>
>
>
> }- Skjul tekst i anførselstegn -
>
> - Vis tekst i anførselstegn -

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For 
more information about this change, please read [http://goo.gl/xkfl] or visit 
the Group home page.

Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to