So, to be more specific, OnClick is working just fine if I'm using a view item (Such as a button). As far as menu items go though, it's failing completely.
Here's my main.xml from the menu folder:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:showAsAction="never"
android:title="@string/action_settings"
android:onClick="openSettings" />
<item
android:id="@+id/action_high_scores"
android:orderInCategory="100"
android:showAsAction="always"
android:title="@string/action_high_scores" />
And here's the relevant code from MainActivity.java:
public void openSettings(MenuItem item) {
Intent openSettings = new Intent(getApplicationContext(), Settings.class);
startActivity(openSettings);
}
I've placed the openSettings method before and after the onCreateOptionsMenu() method declaration but it made no difference.
Every time, it returns the same error: NoSuchMethodException Ideas? Thanks in advance.
(UPDATE: I'm on API 15 so no, it's NOT an API compatibility issue. Using onClick in the Menu list works 100% with API's 11 and greater, so please don't tell me to use the onMenuItemSelected method.)
UPDATE: So I plugged in my tablet (API 11, Honeycomb) and POOF! It works! For some reason or another, API 15, 4.0.4 ISC isn't working with this!?!?! Any ideas what would be causing it? (In the meantime, for compatability, it looks like I may have to override onMenuItemSelected after all, despite my wishes otherwise. Did I just hit a major bug with API 15?