Hi,
Sorry for my lousy prose, but you'll get the points.
1.Please make sure you are adding following permissions to
AndroidManifest.xml.
<uses-permission
android:name="android.permission.ACCESS_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
http://code.google.com/android/migrating/m3-to-m5/m5-api-changes.html#geo
2."new MapView(this)" just constructs new its object. (And you'll fail
this instruction.)
Don't you add view of MapView class to your layout file? If so, please
replace it to the following statement assuming that you are adding
android:id="@+id/map" to your MapView.
mMapView = (MapView) findViewById(R.id.map);
Then, you'll get the map around our Holy Place!
Best Regards,
Tatsu
http://www.tatsu.com
On Apr 16, 10:03 pm, [EMAIL PROTECTED] wrote:
> How to update my current location from GPS
> I got the current location from GPS with the following method,
> i want to update the my current location
> any body help me how to do it
>
> // method to get current location from gps
>
> public void gotoCurrentGPSPosition() {
> bubbleIcon = BitmapFactory.decodeResource(getResources(),
> R.drawable.bubble);
> shadowIcon = BitmapFactory.decodeResource(getResources(),
> R.drawable.shadow);
>
> this.myLocationManager = (LocationManager)
> getSystemService(Context.LOCATION_SERVICE);
> mMapView = new MapView(this);
> MapController mc = mMapView.getController();
> currentGPSLocationOfPhone =
> myLocationManager.getCurrentLocation("gps");
> // Create a Point that represents our GPS-Location
> Double lat = this.currentGPSLocationOfPhone.getLatitude() *
> 1E6;
> Double lng = this.currentGPSLocationOfPhone.getLongitude() *
> 1E6;
> // My gps location
> point = new Point(lat.intValue(), lng.intValue());
>
> MapLocationOverlay mylocation = new MapLocationOverlay();
> OverlayController overlaycontrol =
> mMapView.createOverlayController();
> overlaycontrol.add(mylocation, true);
>
> // mc.setFollowMyLocation(true);
> mc.animateTo(point);
> mc.zoomTo(21);
> mMapView.toggleSatellite();
> setContentView(mMapView);
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---