Nothing wrong with the code or the tutorial. All about customizing your emulator. You need to configure the emulator so that it has soft buttons. Go to the "Device Definition" tab and edit the device that uses the "Software" buttons, as shown in the figure below.

Alternatively, you can simply disable the "Keyboard / Hardware keyboard present" property in the ADV configuration (see the figure below) and restart the emulator.

Android 4.0 emulates an old-style menu if a hardware menu is present. That is why all menu actions will take place. If you disable the hardware menu in the emulator, then the actions will go to the action bar, as expected.
Please note that on phones with hardware menu buttons, such as the Samsung G2, G3 popup menu, etc., they will still be displayed, and you cannot change this in your code. Android will decide what is best for users on each device.
Update
One more note. If you use the compatibility library, make sure you use xmlns:yourapp="http://schemas.android.com/apk/res-auto" and yourapp:showAsAction="always" , as described below.
However, if your application uses the support library for compatibility with the version with Android 2.1, the showAsAction attribute is not accessible from the android: namespace namespace. Instead, this attribute is provided by the Support Library, and you must define your own XML namespace and use this namespace as the attribute prefix.
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourapp="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" yourapp:showAsAction="always" /> ... </menu>
source share