I'm trying to dynamically set the title of my menu.
Retrieving and setting it as such:
ItemView menuTitle = ((ItemView) findViewById(R.id.menu_filter));
menuTitle.setTitle("TITLE_HERE");
works just fine so long as it's in the onOptionsItemSelected(MenuItem item)
method.
I haven't been able to find a way to set this from the onPrepareOptionsMenu
or onCreateOptionsMenu
methods as findViewById
returns null (even after inflating the menu).
Oddly enough there doesn't seem to be anything in the documentation for accomplishing this and google searches haven't turned up much for such a seemingly simple problem.