Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - map current location and zoom controls

map current location and zoom controls

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

map current location and zoom controls

Postby cnbishop » Mon Jun 21, 2010 5:54 am

hi, i have two questions:

1. i get the following error with this line of code: mapView.setBuiltInZoomControls(true);

06-20 18:33:11.871: WARN/dalvikvm(1235): VFY: unable to resolve virtual method 117: Lcom/google/android/maps/MapView;.setBuiltInZoomControls (Z)V

i thought this was the correct use since the other way (getZoomControls) was deprecated??

2. i am using the code below to get my current location - however sometimes it jumps around a bit - for example it might pick a location that i was at earlier in the day, or it might pick a location very close to where i actually am at that moment. just curious as to why it changes every time i test my app on the phone:

Code: Select all
LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        LocationListener myLocationListener = new CurrentLocationListener();
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f, myLocationListener);
        Location currentLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        double Latitude = currentLocation.getLatitude();
        double Longitude = currentLocation.getLongitude();
        // adds the user location as a point on the map
        point = new GeoPoint((int)(Latitude * 1e6),(int)(Longitude * 1e6));

        //set up map overlays ("views") that show images
        mapOverlays = mapView.getOverlays();
        drawable = this.getResources().getDrawable(R.drawable.icon);
        itemizedOverlay = new GameOverlay(drawable);
       
       
        //testing on emulator
        //point = new GeoPoint(37779300, -122419200);
       
        OverlayItem overlayitem = new OverlayItem(point, "", "");

        // map controller and zoom - zooms in at level 17 to geopoint
        MapController mc = mapView.getController();
        //mc.setZoom(17);
        mc.animateTo(point);
       
        //adds the overlay
        itemizedOverlay.addOverlay(overlayitem);
        mapOverlays.add(itemizedOverlay);


thanks for any help/advice!
cnbishop
Freshman
Freshman
 
Posts: 8
Joined: Wed Feb 10, 2010 12:26 am

Top

Re: map current location and zoom controls

Postby Eagle Eye » Mon Jun 21, 2010 10:54 am

Do you use:
Code: Select all
mapView = (MapView)findViewById(R.id.geoMap);
mapView.setBuiltInZoomControls(true);

?
Eagle Eye
Junior Developer
Junior Developer
 
Posts: 14
Joined: Sun May 23, 2010 6:38 am

Re: map current location and zoom controls

Postby cnbishop » Mon Jun 21, 2010 5:44 pm

i do. here is my oncreate method:

Code: Select all
public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
        //set up the map view - res/game.xml
        setContentView(R.layout.game);
       
        mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
     
        //when clicked goal will be added - see below
        mapView.setOnTouchListener(this);
       
        // cb: this gets the gps location - for phone
       
        LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        LocationListener myLocationListener = new CurrentLocationListener();
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f, myLocationListener);
        Location currentLocation = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        double Latitude = currentLocation.getLatitude();
        double Longitude = currentLocation.getLongitude();
        // adds the user location as a point on the map
        point = new GeoPoint((int)(Latitude * 1e6),(int)(Longitude * 1e6));

        //set up map overlays ("views") that show images
        mapOverlays = mapView.getOverlays();
        drawable = this.getResources().getDrawable(R.drawable.icon);
        itemizedOverlay = new GameOverlay(drawable);
       
       
        //testing on emulator
        //point = new GeoPoint(37779300, -122419200);
       
        OverlayItem overlayitem = new OverlayItem(point, "", "");

        // map controller and zoom - zooms in at level 17 to geopoint
        MapController mc = mapView.getController();
        mc.setZoom(17);
        mc.animateTo(point);
       
        //adds the overlay
        itemizedOverlay.addOverlay(overlayitem);
        mapOverlays.add(itemizedOverlay);

    }

cnbishop
Freshman
Freshman
 
Posts: 8
Joined: Wed Feb 10, 2010 12:26 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 5 guests