I’ve got a ActionBar in my application. I can see it, click on the item etc. But I can’t do anything because the program doesn’t recognize the item in my onOptionsItemSelected function.
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.create_playlist:
// ...
return true;
default : return super.onOptionsItemSelected(item);
}
}
The item create_playlist gives me this error :
create_playlist cannot be resolved or is not a field
Yet this item is defined in my actionbar_menu.xml, with this id. Tutorials I’ve found on the web use the same method and seem to work.
Does anyone know what could be happening here?
Shouldn’t that just be
R.id.create_playlist(without theandroid.prefix)?