Android Development: Undefined Method

android

Solution

`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.

They should look something like this:

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

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

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

Problem

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 Right now I´m at this part ``` @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); } } ``` 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

Original source

Related problems