Android的发展:未定义的方法 [英] Android Development: Undefined Method

查看:110
本文介绍了Android的发展:未定义的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜I'm新到Android和Eclipse。我刚刚从下面的developer.android.com教程。眼下I'm在增加动作条

Hi I´m new to Android and Eclipse. I have just following the tutorial from developer.android.com. Right now I´m in adding ActionBar

现在I'm在这个部分

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle presses on the action bar items
    switch (item.getItemId()) {
        case R.id.action_search:
            openSearch();
            return true;
        case R.id.action_settings:
            openSettings();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}

我收到一个错误 OpenSearch的() openSettings()。它说,该方法 openSettings()是未定义类型 DisplayMessageActivity 。我768,16现在怎么办?
谢谢

I have received an error for openSearch() and openSettings(). It said that The method openSettings() is undefined for the type DisplayMessageActivity. What shoud I do now? Thanks

推荐答案

OpenSearch的() openSettings()是为了创建教程的作者执行其他操作的方法。搜索早已进入code,必须有这些方法某处的声明,如果作者让他们看到。

openSearch() and openSettings() are methods that the author of the tutorial created in order to perform other operations. Search well into the code, there must be somewhere the declaration of those methods, if the author made them visible.

他们应该是这个样子:

public void openSearch() {
    //Do something here.
}

public void openSettings() {
    //Do something here.
}

更换 //这里做什么与本教程中的code实现present。

Replacing the //Do something here with the code implementation present in the tutorial.

这篇关于Android的发展:未定义的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆