While reading through how to install a service in Visual Studio it said to look for the Developer Command Prompt in order to do so.

However, it is not in the Tools menu. If you also happen to encounter this scenario, you can create it yourself.

Do the following:

  • Select “Tools”, then Select “External Tools”
  • Under Title, Enter “Native Tools – Command Prompt” or whatever you want to name it
  • Under Command, Enter “C:\Windows\System32\cmd.exe”
  • Under Arguments, Enter ” /k “C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat”
  • Under Initial Directory, Leave blank or Enter your preferred default directory
  • Click OK

You can now find this under the Tools menu.

By default when you add items in Android’s action bar, the icon will not be shown if it will be shown as overflow.

To make sure an icon appears beside the menu item label like this:


Add a sub menu tag within the item tag like this:

Since this menu item in the action bar is forced to become overflow permanently (appear as icon all the time), I extracted the PNG file ic_action_overflow from the Android menu icon pack and set it to this menu item.

This is it. The XML code above should display the way as the image posted above.

I thought that creating a custom method in my Activity class where I can change the visibility of a MenuItem and accessing it from the Fragment would work. Sadly, it did not.

It seems that the Fragment class has a method called setHasOptionsMenu(boolean) and you need to call that from within the onCreateView() method in order to be able to manipulate MenuItems from within onCreateOptionsMenu().

So this is how a sample Fragment class will look like.

This code looks for the MenuItem and hides it.

Related Posts Plugin for WordPress, Blogger...