Back to the basics
In this exercise, the tutorial had me add a Settings Activity and a link in the menu bar to that page. To achieve this goal, I did the following
- Create
SettingsActivity - Add activity_settings.xml that will eventually be used to add preference items to
- Add the links to the menu xml files
- in
MainActivityoverride theonOptionsItemSelectedmethod and attach an event handler to the settings Link so the application knows tostartActivityon theSettingsintent.
I learned I can organize how menu items display using the item property OrderInCategory. In this particular exercise, we set that property to equal 100, causing it to display below the other menu item.
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"/>
I learned that FrameLayouts are used to block out an area on the screen to display a single item. FrameLayout uses a single item so it is able to scale well when using difference size screens
I learned that android allows users to add a default home button in the menu bar by setting setDisplayShowHomeEnabled property to true.