Which one is better and why?
This one:
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { super.onActivityResult(requestCode, resultCode, intent); ... }
or this:
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { // do not call super.onActivityResult() ... }
Advertisement
Answer
The first one is better.
It’s more consistent with other event functions in the Activity
API, it costs you nothing (the code you’re calling does nothing at the moment), and it means you don’t need to remember to add the call in the future when the behaviour of the base class changes.
Edit
As Su-Au Hwang has pointed out, my prediction about the behaviour of the base class changing in the future has come true! FragmentActivity
requires you to call the method on super
.