Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8505373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:17:59+00:00 2026-06-11T02:17:59+00:00

I’ve this: public class GpsUpdate extends Observable implements LocationListener { private int x_position; private

  • 0

I’ve this:

public class GpsUpdate extends Observable implements LocationListener  {

private int x_position;
private int y_position;
private float currentAccuracy;
public GpsUpdate(Observer observer){
    addObserver(observer);
}


@Override
public void onLocationChanged(Location location) {
    int lat = (int) (location.getLatitude() * 1E6);
    int lng = (int) (location.getLongitude() * 1E6);
    setAccuracy(location.getAccuracy());
    setX_position(lat);
    setY_position(lng);
    setChanged();
    notifyObservers();



}
@Override
public void onProviderDisabled(String provider) {
}


@Override
public void onProviderEnabled(String provider) {
}

@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
}

public int getX_position() {
    return x_position;
}
public void setX_position(int x_position) {
    this.x_position = x_position;

}
public int getY_position() {
    return y_position;

}
public void setY_position(int y_position) {
    this.y_position = y_position;
}

public void setAccuracy(float currentAccuracy) {
    this.currentAccuracy = currentAccuracy;
}


public float getAccuracy(){
    return currentAccuracy;
}

}

this method (onLocationChanged()) notifies another method (update()) in other class that position is changed, but I need to collect all coordinates even that the current is the same like previous.

_GPSUPDATE = new GpsUpdate(this);
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 1, _GPSUPDATE);

    @Override
        public void update(Observable observable, Object data) {
            xCurrent = _GPSUPDATE.getX_position();
            yCurrent = _GPSUPDATE.getY_position();
                     .....
          }

So, what have I to add/change to get position every second?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T02:18:00+00:00Added an answer on June 11, 2026 at 2:18 am

    This is rather bad approach. Even if you need to store location every second then redefine your app logic to store timestamped location. This suffices because (let’s assume T is delta time in seconds) if at T=0 you received and stored locationA, at T=2 you received and stored locationB then if you want to know what location was at T=1 then not seeing explicit record you know there was NO CHANGE of location at that time, so it is clear your location equals to last stored one with closest lower T, in this case at T=1 your location (still) was locationA as it did NOT change since T=0. This is much better approach and would save you hell lot of storage. And if you store this in datbase then getting right results is trivial as well – just search for entry with timestamp less or equal to required, order by timestamp desc, limit 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms
I know there's a lot of other questions out there that deal with this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.