Should the call to the superclass method be the first statement?

后端 未结 2 1432
半阙折子戏
半阙折子戏 2020-12-02 08:52

The results of a speech recognition can be read in the onActivityResult(int requestCode, int resultCode, Intent data) method, as shown in this example. This met

2条回答
  •  爱一瞬间的悲伤
    2020-12-02 09:31

    Because you generally want to perform the events unique to your overridden activity before passing the control back up the class hierarchy. Note that it is not always the case. Sometimes you should put the calls first such as in the callbacks that happen when your app is initialized, and you might want to put them last for events that happen when your app is destroyed so that you can clean up first.

    In general though it doesn't matter and if it does it will be mentioned in the SDK -- I've ran into it mentioned a few places in the SKD (I think on documentation regarding dialogs) but I can't remember exactly which page/section it's on.

    There is some more detailed discussion on the topic here: http://groups.google.com/group/android-developers/browse_thread/thread/9ddb2b06c21c8457

提交回复
热议问题