PDA

View Full Version : Android, A correct place to initialize annotations



kimyll
17.03.2015, 11:42
There is example code in http://developer.skobbler.com/getting-started/android#sec009 regarding to annotations. However the snippet won't reveal if it is onResume, onSurfaceCreated or in some other place.

The demo project sets annotations after option menu click and that works fine for me too.

However, I would like to show my annotations right after the map is loaded. Tried to set annotations in onResume and onSurfaceCreated methods. They didn't show up.

This did work (within onResume):

final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
addAnnotations();
}
}, 2000);

But it can't be a correct way to do the thing?