周末在家,利用空闲时间写了Activity,但是本来想重载

    public boolean onOptionsItemSelected(MenuItem item) {
        if (mParent != null) {
            return mParent.onOptionsItemSelected(item);
        }
        return false;
    }

但是,不知到当时哪个筋出问题了,就重载了:

    public boolean onMenuItemSelected(int featureId, MenuItem item) {
switch (featureId) {
case Window.FEATURE_OPTIONS_PANEL:
// Put event logging here so it gets called even if subclass
// doesn't call through to superclass's implmeentation of each
// of these methods below
EventLog.writeEvent(50000, 0, item.getTitleCondensed());
return onOptionsItemSelected(item);

case Window.FEATURE_CONTEXT_MENU:
EventLog.writeEvent(
50000, 1, item.getTitleCondensed());
return onContextItemSelected(item);

default:
return false;
}
}

而且在子类中,是按照

onOptionsItemSelected来处理的。

所以导致上下文菜单能够弹出,但是无法处理,....

最后发现是把Activity中的所有函数的入口点都打开,才找到的。

相关文章:

  • 2021-10-19
  • 2022-02-04
  • 2021-10-12
  • 2022-12-23
  • 2021-06-19
  • 2021-07-10
  • 2022-12-23
猜你喜欢
  • 2021-09-08
  • 2022-12-23
  • 2021-12-10
  • 2021-11-23
  • 2021-10-24
  • 2021-06-11
  • 2021-07-05
相关资源
相似解决方案