Reputation: 91
Inside of my onCreateOptionsMenu function I implemented this:
mymenuitem.setOnMenuItemClickListener(new OnMenuItemClickListener(){
public boolean onMenuItemClick(MenuItem item){
update_freq=1;
showChosen(); (some user defined function)
update_time();
return true;
}
});
However, the .setOnMenuItemClickListener only be called the first time I click my preference, later on when I went back to menu and click preference buttons, it never be called. can anyone tell me what is the problem? My menu is written in xml file and inflated.
Upvotes: 2
Views: 5092
Reputation: 33741
I think you need to override onOptionsItemSelected
. The OnMenuItemClickListener is set on a single, specific MenuItem.
Upvotes: 1