Calling onCreate on a View explicitly.

2 posts / 0 new
Last post
Calling onCreate on a View explicitly.

Just getting started with MapQuest Android API (an exciting time). In the demo, I see MainActivity's onCreate() explicitly calling the MapView's onCreate().
In my limited experience, I have not seen this. Is this a common idiom for 3rd party APIs? Is it common in any particular arena? I'd appreciate any insights one has on this very general question.

Good question. No, it's not
Good question. No, it's not very common that I'm aware of. I believe the reasoning behind the callback naming and usage is to make it clear that the view is expecting the developer to explicitly call the methods at specific points in the code (calling onResume() in the parent activity's/fragment's onResume() callback implementation). Those methods could have been named something else like initialize, deinitialize, etc. but since it is specifically an android sdk its a lot more clear to name the methods after the android lifecycle callbacks in which they are meant to be called in.