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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:03:49+00:00 2026-06-06T12:03:49+00:00

i have tryed to make my own app and to use google maps. I

  • 0

i have tryed to make my own app and to use google maps. I want it to set the center of the map on my curent gps position, but when i have a gps lock on my phone i will just go to these coordinates (0,0) I dont know where i went wrong. Thanks everybody 😀

import android.content.Context;
import android.location.Location;
import android.location.LocationListener; 
import android.location.LocationManager;
import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;


public class Courses extends MapActivity {

MapView map;


@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.courses);       
    MapView map = (MapView) findViewById (R.id.MapView);
    map.setBuiltInZoomControls(true);
    map.setSatellite(true);
    final MapController control = map.getController();


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

    LocationListener listener = new LocationListener() {
        @Override
        public void onLocationChanged(Location location) {
            // TODO Auto-generated method stub
            control.setCenter(new GeoPoint((int)location.getLatitude(),(int)location.getLongitude()));              
            control.setZoom(19);
        }

        @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

        }

    };


manager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, listener);

}


@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}

}
`

  • 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-06T12:03:50+00:00Added an answer on June 6, 2026 at 12:03 pm

    The first issue I see here is, that location.getLatitude() and location.getLongitude() return float, which have to be multiplied with 1E6 and then casted as an int to be acceptible for GeoPoint. This also explains why you have coordinates of approximately 0,0

    I would suggest replacing your control.setCenter(new GeoPoint((int)location.getLatitude(),(int)location.getLongitude())); with control.setCenter(new GeoPoint((int)(location.getLatitude() * 1E6),(int)(location.getLongitude() * 1E6)));

    Try that, it should work then.

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

Sidebar

Related Questions

I have an Android app that creates its own files in Google Drive with
How to make a sticky footer i have tried on google found some results
EDIT, CLARIFICATION: * I want to be able to set eventHandlers using my own
I'm trying to make my own gps-tracker, mainly for bike-rides. I managed to make
In my ever so harsh endeavor to make my own apps, i have hit
I want to start the Maps application from my app. A pin with a
I have tried to make the fullscreen feature of a SDI application with splitter
This might get a little confusing as I have tried everything to make this
How do I make the following url forbidden in apache; main/index.php?site=ing I have tried
I tried to make admin panel and I am using sessions , but have

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.