悲催了,写了10分钟都不到,找BUG找了2个小时

周末在家,利用空闲时间写了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中的所有函数的入口点都打开,才找到的。

posted on 2011-08-23 17:51 梦书 阅读(90) 评论(0) 编辑 收藏

导航

公告