[android-developers] Re: Question regarding GPS
When you first go above the start threshold then set a member variable to the time. When you go above the end threshold then subtract that from the current time to get the time elapsed. On Oct 3, 11:43 am, Sonic nitroussi...@googlemail.com wrote: Hi All, I'm wondering how I would go about the following: An int value is sent to a textview called X for example, the value of X is constantly changing, so x could equal any int. Now what Im unsure how to implement is, if we say X equals 10, I want to be able to time how long it takes inbetween the time X would be equal to 40 for example. The values of X = 10 and X = 40 are not going to be constant it will be gradually increasing, so all as I want to do is time how long it takes in seconds to reach a predefined value of X. Any ideas chaps? --~--~-~--~~~---~--~~ 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: Question regarding GPS
Thanks for that, but how would I get it to automatically watch the textview values of x to automatically stop the timer after reaching a specific value? Would I need to use some kind of listener? Thanks in advance. On Oct 3, 6:08 pm, Lance Nanek lna...@gmail.com wrote: When you first go above the start threshold then set a member variable to the time. When you go above the end threshold then subtract that from the current time to get the time elapsed. On Oct 3, 11:43 am, Sonic nitroussi...@googlemail.com wrote: Hi All, I'm wondering how I would go about the following: An int value is sent to a textview called X for example, the value of X is constantly changing, so x could equal any int. Now what Im unsure how to implement is, if we say X equals 10, I want to be able to time how long it takes inbetween the time X would be equal to 40 for example. The values of X = 10 and X = 40 are not going to be constant it will be gradually increasing, so all as I want to do is time how long it takes in seconds to reach a predefined value of X. Any ideas chaps? --~--~-~--~~~---~--~~ 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: Question regarding GPS
Doing simple linear from the 1st sample: When we start we will have: originalX at time originalTime When a sample arrives we will have: currentX at time currentTime Therefore the rate of change of X to now is given by: rateX = (currentX – originalX) / (currentTime – originalTime) So time needed to get to endX (your value 40) from currentX timeNeeded = (endX – currentX) * rateX However if currentX is fluctuating a large amount then so will timeNeeded. You can use this approach with more points (taking their average) for a more stable approximation. On Oct 3, 6:08 pm, Lance Nanek lna...@gmail.com wrote: When you first go above the start threshold then set a member variable to the time. When you go above the end threshold then subtract that from the current time to get the time elapsed. On Oct 3, 11:43 am, Sonic nitroussi...@googlemail.com wrote: Hi All, I'm wondering how I would go about the following: An int value is sent to a textview called X for example, the value of X is constantly changing, so x could equal any int. Now what Im unsure how to implement is, if we say X equals 10, I want to be able to time how long it takes inbetween the time X would be equal to 40 for example. The values of X = 10 and X = 40 are not going to be constant it will be gradually increasing, so all as I want to do is time how long it takes in seconds to reach a predefined value of X. Any ideas chaps? --~--~-~--~~~---~--~~ 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: Question regarding GPS
Ok, I understand the principle behind this, but unsure how it would be implemented. How could you you get the current start time when the value of X is greater than 30 for example, so it wouldnt start if it was below this. Im unsure of how to pass in the value of x into this? On Oct 3, 6:29 pm, RichardC richard.crit...@googlemail.com wrote: Doing simple linear from the 1st sample: When we start we will have: originalX at time originalTime When a sample arrives we will have: currentX at time currentTime Therefore the rate of change of X to now is given by: rateX = (currentX – originalX) / (currentTime – originalTime) So time needed to get to endX (your value 40) from currentX timeNeeded = (endX – currentX) * rateX However if currentX is fluctuating a large amount then so will timeNeeded. You can use this approach with more points (taking their average) for a more stable approximation. On Oct 3, 6:08 pm, Lance Nanek lna...@gmail.com wrote: When you first go above the start threshold then set a member variable to the time. When you go above the end threshold then subtract that from the current time to get the time elapsed. On Oct 3, 11:43 am, Sonic nitroussi...@googlemail.com wrote: Hi All, I'm wondering how I would go about the following: An int value is sent to a textview called X for example, the value of X is constantly changing, so x could equal any int. Now what Im unsure how to implement is, if we say X equals 10, I want to be able to time how long it takes inbetween the time X would be equal to 40 for example. The values of X = 10 and X = 40 are not going to be constant it will be gradually increasing, so all as I want to do is time how long it takes in seconds to reach a predefined value of X. Any ideas chaps? --~--~-~--~~~---~--~~ 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: Question regarding GPS
It is good policy to keep logic like this separate from the view. I'd put the logic wherever you are getting the value from, before you send that value to the TextView. In the onLocationChanged method of your LocationListener implementation, for example, if you are using a listener to receive location updates. On Oct 3, 1:15 pm, Sonic nitroussi...@googlemail.com wrote: Thanks for that, but how would I get it to automatically watch the textview values of x to automatically stop the timer after reaching a specific value? Would I need to use some kind of listener? Thanks in advance. On Oct 3, 6:08 pm, Lance Nanek lna...@gmail.com wrote: When you first go above the start threshold then set a member variable to the time. When you go above the end threshold then subtract that from the current time to get the time elapsed. On Oct 3, 11:43 am, Sonic nitroussi...@googlemail.com wrote: Hi All, I'm wondering how I would go about the following: An int value is sent to a textview called X for example, the value of X is constantly changing, so x could equal any int. Now what Im unsure how to implement is, if we say X equals 10, I want to be able to time how long it takes inbetween the time X would be equal to 40 for example. The values of X = 10 and X = 40 are not going to be constant it will be gradually increasing, so all as I want to do is time how long it takes in seconds to reach a predefined value of X. Any ideas chaps? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---