问题描述
我期待在从Android开发者网站上的记事本教程。我有一个关于重载函数调用超一流的活动问题。例如,
I'm looking at the Notepad tutorial from the Android developer's site. I have a question about overridden functions calling the super-class of activities. For example,
public class Notepadv3 extends ListActivity {
...
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
menu.add(0, INSERT_ID, 0, R.string.menu_insert);
return true;
}
}
什么是在 super.onCreateOptionsMenu()的地步?我看着,发现这样的解释:
What's the point of the super.onCreateOptionsMenu()? I looked at the developer's site and found this explanation:
的呼叫super.onCreateOptionsMenu(菜单),所以原来的菜单项的创建,然后用menu.add添加新的菜单项()。的
但原来的菜单项目有哪些?
But what original menu items are there?
同样,有什么其他的超点。(overridden_function),如 super.onCreateContextMenu
Similarly, what's the point of other super.(overridden_function), such as super.onCreateContextMenu?
推荐答案
活动有多项业务,他们在其整个生命周期内完成 - 其中一些是家里打扫(垃圾收集),UI的东西,等等。
Activities have a number of operations they perform throughout their life cycle - some of these are house cleaning (garbage collection), UI stuff, etc.
据我所知, super.onCreateContextMenu()没有被调用,像不像方法的onCreate onResume 等等。
As far as I know, super.onCreateContextMenu() doesn't have to be called, unlike methods like onCreate, onResume, etc.
这篇关于安卓:之所以叫超?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!