The root of the issue is that button is being removed twice, causing NullPointerException on the second removal.
It is so because button is removed from the map on OverlayPresenter#onButtonMoved() at first normally, then activity is stopped, causing the button to be removed again on OverlayPresenter#onActivityStopped(Activity activity). As it seems that both calls are expected simple null check will have suffice here to prevent an unhandled exception that crash the app.
The root of the issue is that button is being removed twice, causing NullPointerException on the second removal. It is so because button is removed from the map on
OverlayPresenter#onButtonMoved()
at first normally, then activity is stopped, causing the button to be removed again onOverlayPresenter#onActivityStopped(Activity activity)
. As it seems that both calls are expected simple null check will have suffice here to prevent an unhandled exception that crash the app.