Lydia
Lydia

Reputation: 625

onOptionsItemSelected, return super.onOptionsItemSelected(item) explaination

For onOptionsItemSelected method, this method would only be invoked if an item is clicked, right? If an item is clicked in that activity, but for some weird reason the programmer did not have the if statement to check for that item's id, does return super.onOptionsItemSelected(item) enter into an infinite loop of keep calling this method?

My guess of super.onOptionsItemSelected(item); means calling the parent class and invoke this method again?

Upvotes: 4

Views: 1382

Answers (1)

mthandr
mthandr

Reputation: 3061

No, it calls the parent's class method so it has a chance to run what it needs to run. If you were to use something like this.onOptionsItemSelected(item); then it would be a infinite loop.

Upvotes: 3

Related Questions