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

  • Home
  • SEARCH
  • 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 8305161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:01:19+00:00 2026-06-08T18:01:19+00:00

I’m here agan. I got another question about google maps in android. I’m trying

  • 0

I’m here agan. I got another question about google maps in android. I’m trying to update the map displayed in the map view in such a way that when the location of the user is updated through gps, the map will display the map of that location.

I’m currently using GeoPoint and MapController but I wasn’t getting the result. Instead it is animating to a wrong location. I tried interchanging the longitude and latitude values but the result is still the same.

Here is the source code for my activity.

public class MyActivity extends MapActivity {

LocationManager manager;
Location currentLocation;

MapController mapController;

TextView locationView;

MapView mapView;

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

    locationView = (TextView) findViewById(R.id.textView);

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

    mapController = mapView.getController();
    mapController.setZoom(5);

    manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
}

@Override
protected void onPause() {
    super.onPause();
    manager.removeUpdates(listener);
}

@Override
protected void onResume() {
    super.onResume();
    if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Location Manager");
        builder.setMessage("We want to use your location, but GPS is currently disabled.\nWould you like to change these settings now?");
        builder.setPositiveButton("Yes",
                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        Intent i = new Intent(
                                Settings.ACTION_LOCATION_SOURCE_SETTINGS);
                        startActivity(i);
                    }
                });
        builder.setNegativeButton("No",
                new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        finish();
                    }
                });
        builder.create().show();
    }

    currentLocation = manager
            .getLastKnownLocation(LocationManager.GPS_PROVIDER);
    updateDisplay();
    int minTime = 5000;
    float minDistance = 0;
    manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, minTime,
            minDistance, listener);
}

private void updateDisplay() {
    if (currentLocation == null) {
        locationView.setText("Determining your location...");
    } else {
        locationView.setText(String.format("Your location:\n%.2f, %.2f",
                currentLocation.getLatitude(),
                currentLocation.getLongitude()));

    }

}

private LocationListener listener = new LocationListener() {

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

    @Override
    public void onProviderEnabled(String provider) {

    }

    @Override
    public void onProviderDisabled(String provider) {

    }

    @Override
    public void onLocationChanged(Location location) {

        currentLocation = location;

        GeoPoint point = new GeoPoint((int) currentLocation.getLatitude(),
                (int) currentLocation.getLongitude());

        mapController.setCenter(point);
        updateDisplay();
    }
};

@Override
protected boolean isRouteDisplayed() {
    return false;
}
}

I’m quite sure there is no problem in the xml and manifest since the Google Map itself is being displayed. Thanks for the 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-06-08T18:01:21+00:00Added an answer on June 8, 2026 at 6:01 pm

    Did you remember to convert to microdegrees? From the documentation:Constructs a GeoPoint with the given latitude and longitude, measured in microdegrees (degrees * 1E6). So, you need to multiply the lat and long you got from the location listener by 1E6 otherwise it will animate most likely to a location off the coast of Africa.

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm making a simple page using Google Maps API 3. My first. One marker
I don't have much knowledge about the IPv6 protocol, so sorry if the question
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am trying to render a haml file in a javascript response like so:

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.