how to capture current location latlong to textbox arcgis android

2457
1
Jump to solution
12-29-2015 02:42 AM
tulasamirji1
New Contributor II

plz help me

0 Kudos
1 Solution

Accepted Solutions
MengyiGuo
Occasional Contributor

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);

}

}

View solution in original post

1 Reply
MengyiGuo
Occasional Contributor

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);

}

}

View solution in original post