[英]return super.onOptionsItemSelected(item); is not calling the parent method
[英]onOptionsItemSelected, return super.onOptionsItemSelected(item) explaination
對於onOptionsItemSelected
方法,只有在單擊某個項目時才會調用此方法,對吧? 如果在該活動中單擊了一個項目,但由於一些奇怪的原因,程序員沒有if語句來檢查該項目的id,是否返回super.onOptionsItemSelected(item)
進入一個無限循環繼續調用此方法?
我對super.onOptionsItemSelected(item);
猜測super.onOptionsItemSelected(item);
意味着調用父類並再次調用此方法?
不,它調用父類的方法,因此它有機會運行它需要運行的東西。 如果你使用像this.onOptionsItemSelected(item)這樣的東西; 那么這將是一個無限循環。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.