Android: How to get an ActionBar menu item icon to appear in the action bar

I couldn’t get an Android ActionBar menu item icon to appear in the action bar until I followed the XML namespace example shown in the image (which comes from this url). Android Studio kept warning me that android:showAsAction... wasn’t right, but I didn’t know how to solve the problem until I found this code in the docs.

For the record, my menu’s resource XML file now looks like this:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:myapp="http://schemas.android.com/apk/res-auto">
    <item android:id="@+id/menu_item_new_crime"
          android:icon="@android:drawable/ic_menu_add"
          android:title="@string/new_quote"
          myapp:showAsAction="ifRoom" />
</menu>

The myapp:showAsAction code in there is what solved the problem, and made my menu item icon properly appear in the action bar (and not in the overflow menu, where it had been hidden).

Photo D8