Please check out this sample:
Nearby Sample | ArcGIS for Developers
// Zooms to the current location when first GPS fix arrives.
@Override public void onLocationChanged(Location loc) {
if (!locationChanged) {
locationChanged = true;
double locy = loc.getLatitude();
double locx = loc.getLongitude();
Point wgspoint = new Point(locx, locy);
Point mapPoint = (Point) GeometryEngine .project(wgspoint, SpatialReference.create(4326), mMapView.getSpatialReference());
Unit mapUnit = mMapView.getSpatialReference() .getUnit();
double zoomWidth = Unit.convertUnits( SEARCH_RADIUS, Unit.create(LinearUnit.Code.MILE_US), mapUnit);
Envelope zoomExtent = new Envelope(mapPoint, zoomWidth, zoomWidth); mMapView.setExtent(zoomExtent);
}
}
Please check out this sample:
Nearby Sample | ArcGIS for Developers
// Zooms to the current location when first GPS fix arrives.
@Override public void onLocationChanged(Location loc) {
if (!locationChanged) {
locationChanged = true;
double locy = loc.getLatitude();
double locx = loc.getLongitude();
Point wgspoint = new Point(locx, locy);
Point mapPoint = (Point) GeometryEngine .project(wgspoint, SpatialReference.create(4326), mMapView.getSpatialReference());
Unit mapUnit = mMapView.getSpatialReference() .getUnit();
double zoomWidth = Unit.convertUnits( SEARCH_RADIUS, Unit.create(LinearUnit.Code.MILE_US), mapUnit);
Envelope zoomExtent = new Envelope(mapPoint, zoomWidth, zoomWidth); mMapView.setExtent(zoomExtent);
}
}