cocos2d/cocos2d-x — pull request #3871 by michaelcontento (2013-10-02 10:13:23+00:00)
Title: Android add onActivityResult listener

For some third-party libs it's required to handle messages send to `onActivityResult` of the main activity. But with the transition to `NativeActivity` this rather difficult to add custom callbacks to `onActivityResult`.

With this change it's possible to register listeners that get called once something triggers `onActivityResult`. All listeners are stored and managed in `Cocos2dxHelper`, because it seems to be the current best place for "helper stuff that android requires here and there". `Cocos2dxNativeActivity` is the new root activity and inherits from `NativeActivity`. The only change here is a little loop in `onActivityResult` to iterate through and call all listeners.

#### Why don't store and manage all listeners in `Cocos2dxNativeActivity` itself?
I'd like to keep the `Cocos2dxNativeActivity` as short, simple and close to the `NativeActivity` as possible. And by moving all helper stuff into `Cocos2dxHelper` it's pretty easy to search/grep through all java files and have a look at such custom integrations (similar to `(int)` vs `static_cast()` in C++).