Changing menu items based on what layout is being used

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Changing menu items based on what layout is being used

Postby kutch » Tue Apr 28, 2009 7:26 pm

I'm trying to change my menu for my application when I go to the 'settings' layout from my 'main window' layout. For example, in my 'main window' layout, there is a menu item called "settings". When clicked, it will go to the settings layout and I no longer want that option in my menu.

I am trying to remove this menu item based on what view I'm in as follows, but it always seems to believe it's true no matter what layout Id I compare the current one with:

Code: Select all

@Override
public boolean onPrepareOptionsMenu(final Menu menu) {       
   if(this.getCurrentFocus() == this.findViewById(R.layout.settings)){
      Log.d("DEBUG", "IN SETTINGS VIEW");
   }
   else{
      Log.d("DEBUG", "NOT IN SETTINGS VIEW");
   }
    return super.onPrepareOptionsMenu(menu);
}
kutch
Freshman
Freshman
 
Posts: 5
Joined: Tue Apr 28, 2009 7:12 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 13 guests