Select to view content in your preferred language

Location Display Manager & retainState functionality

3825
0
12-08-2014 01:00 PM
lqdeffx
Deactivated User

I've noticed that when I save/restore my MapView state it only makes a distinction between start/stop when it should also identify between resume/pause.

my use-case

A toggle button that will show/hide current location.

Originally, I created my action event to utilize pause/resume as it doesn't make any sense to have to re-create the LocationDisplayManager every time.  The problem occurs when my fragment saves it state in onPause( ).  With my LocationDisplayManager object paused, MapView.retainState( ) sees it as active and will display the current location when the fragment becomes active again.

As a workaround, I now call LocationDisplayManager.stop( ) method in onPause( ) and add extra checks and rebuild my LocationDisplayManager when I want to use it.

0 Kudos
0 Replies