Select to view content in your preferred language

Android ArcGis map auto zooms out on activity resume

794
1
09-11-2018 08:45 AM
AnousoneBounket
New Contributor

The first time I resume activity, the map zooms out to a larger extent. Example, I view the map the first time, it centers and zooms in on user location. Then I leave the activity, return to the activity, and it zooms out to the map's default extent.

In my onCreate, I am loading map layers via MMPK and then calling the following afterwards.

    mMapView.getMap().setBasemap(Basemap.createImagery());
    mMapView.setViewpointScaleAsync(4622324);

    mLocationDisplay.setAutoPanMode(LocationDisplay.AutoPanMode.RECENTER);
    if (!mLocationDisplay.isStarted())
        mLocationDisplay.startAsync();

But this issue only occurs on the first time I resume activity. After recentering or zooming/moving the map following the autozoom, there's no more issues with the auto zoom to map extent when I leave the activity a 2nd time.

Tags (1)
0 Kudos
1 Reply
SahilGarg
New Contributor

I guess you need to use

mMapView.getMap().setInitialViewpoint() 

when you start your activity. Using this your map will not zoomed out when your activity resumed.
0 Kudos