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 3976220
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:46:43+00:00 2026-05-20T04:46:43+00:00

As topic I’m currently in sweden but when launching my map it shows that

  • 0

As topic I’m currently in sweden but when launching my map it shows that I’m in England.

My code looks like this:

private MapListener myMapViewListener;
private MapController mapController;
private GeoPoint test;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mapview);
    setupListener();

    MapView mapView = (MapView) findViewById(R.id.mapview);
    mapController = mapView.getController();
    mapView.setBuiltInZoomControls(true);
    mapView.setClickable(true);

     mapController.setZoom(7); // defualt zoom    
}

private void setupListener() {

    LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
    MapListener listener = new MapListener();
    MapView mapView = (MapView) findViewById(R.id.mapview);

    LocationListener locationListener = new LocationListener() {
        public void onLocationChanged(Location location) {
            test = new GeoPoint((int)location.getLatitude()*1000000, (int)location.getAltitude()*1000000);
            mapController.animateTo(test);
        }

        @Override
        public void onProviderDisabled(String provider) {
            // TODO Auto-generated method stub

        }
        @Override
        public void onProviderEnabled(String provider) {
            // TODO Auto-generated method stub

        }
        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {
            // TODO Auto-generated method stub

        }
    };
    locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener);
}

}

I’ve added……..

    <uses-library android:name="com.google.android.maps" />
</application>

 <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-   permission>
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>   

  </manifest>

….. in my manifest.

I’m using http://developer.android.com/guide/topics/location/obtaining-user-location.html as a guide.

Very thankful for help!

  • 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-05-20T04:46:43+00:00Added an answer on May 20, 2026 at 4:46 am

    it is converting to an int before it does the multiplication so you need parens around the calculation.
    Replace with this.

    test = new GeoPoint((int)(location.getLatitude()*1000000), 
         (int)(location.getLongitude()*1000000));
    

    You also might want to check out MyLocationOverlay if you want to draw your location on a map.

    To use MyLocationOverlay.

    MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, mapView);
    mapView.getOverlays().add(myLocationOverlay);
    myLocationOverlay.enableMyLocation();
    

    In on pause you should also call myLocationOverlay.disableMyLocation() so it doesn’t drain battery when your activity is in the background.

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

Sidebar

Related Questions

I know that this topic was discussed there a lot of times, but I've
This topic has been covered on this forums, but I haven't found a working
This topic has been scratched once or twice, but I am still puzzled. And
This topic can look similar to others but I haven't found any usable answer
In similar topic I've asked if that is possible at all (http://stackoverflow.com/questions/6006364/svg-through-the-jquery-svg), but when
This topic has been covered in one form or another but none of the
I know this topic has been beat to death but a lot of the
I have read some topic regarding with my question but there code doesn't work
This topic has been discussed but I've been unsuccessful. I have a basic mesh
This topic was mentioned in my CS data structure class, but I didn't quit

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.