Search code examples
androidloadingandroid-mapviewmapactivity

android activity "loaded event"


I have a mapactivity and when I switch over to it it takes some time before it appears because it loads the map and animates to the specific location.

does activity have some sort of finished loading event ao i can do the map initialization there?

Thanks


Solution

  • If I understand your question correctly, it's not a matter of events, it's a matter of proper programming.

    If your activity takes a long time to initialize, you should do the initialization in a background thread (Android supplies the easy to use AsyncTask). While initializing, you should present some temporary content to the user, like a splash screen, a "Loading..." message with a progress bar, or in your case, maybe the last map location (which you probably already have cached).

    Try to make the activity life cycle methods (onCreate, onResume, etc), as short and as fast as possible, to make your activity loading snappier, and keep your UI responsive.

    See the Designing For Responsiveness entry on the Developer's Guide