April 2019
Beginner to intermediate
698 pages
15h 15m
English
You may have noticed that there are two other autogenerated functions in the code of all our projects using the Basic Activity template. They are onCreateOptionsMenu and onOptionsItemSelected. Many Android apps have a pop-up menu, so Android Studio generates one by default when using the Basic Activity template, including the outline of the code to make it work.
You can see the XML that describes the menu in res/menu/menu_main.xml from the project explorer. The key lines of XML code are as follows:
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never" />This describes a menu item with the Settings text. If you run any of our apps built ...
Read now
Unlock full access