java.lang.Object | ||
↳ | android.support.v4.content.ContextCompat | |
↳ | android.support.v4.app.ActivityCompat |
Helper for accessing features in Activity
introduced after API level 4 in a backwards compatible fashion.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Invalidate the activity's options menu, if able.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.support.v4.content.ContextCompat
| |||||||||||
From class
java.lang.Object
|
Invalidate the activity's options menu, if able.
Before API level 11 (Android 3.0/Honeycomb) the lifecycle of the
options menu was controlled primarily by the user's operation of
the hardware menu key. When the user presses down on the menu key
for the first time the menu was created and prepared by calls
to onCreateOptionsMenu(android.view.Menu)
and
onPrepareOptionsMenu(android.view.Menu)
respectively.
Subsequent presses of the menu key kept the existing instance of the
Menu itself and called onPrepareOptionsMenu(android.view.Menu)
to give the activity an opportunity to contextually alter the menu
before the menu panel was shown.
In Android 3.0+ the Action Bar forces the options menu to be built early
so that items chosen to show as actions may be displayed when the activity
first becomes visible. The Activity method invalidateOptionsMenu forces
the entire menu to be destroyed and recreated from
onCreateOptionsMenu(android.view.Menu)
, offering a similar
though heavier-weight opportunity to change the menu's contents. Normally
this functionality is used to support a changing configuration of Fragments.
Applications may use this support helper to signal a significant change in
activity state that should cause the options menu to be rebuilt. If the app
is running on an older platform version that does not support menu invalidation
the app will still receive onPrepareOptionsMenu(android.view.Menu)
the next time the user presses the menu key and this method will return false.
If this method returns true the options menu was successfully invalidated.
activity | Invalidate the options menu of this activity |
---|