This is a good resource for LibGDX programming on Android.
Android FAQ: When is the Android Fragment
onCreateOptionsMenu method called?
I was just working through a problem with an Android Menu and MenuItem, and added some debug code to the methods in my Android Fragment, and found that the
onCreateOptionsMenu method is called after
onStart. I didn’t put Log/debug code in every activity lifecycle method, but for the ones I did add logging code to, the specific order of the fragment method calls looked like this:
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 13.4, “Understanding the methods in the Scala/Akka Actor lifecycle.”
You’re creating more complicated actors, and need to understand when the methods on an
Actor are called.
In addition to its constructor, an
Actor has the following life-cycle methods:
The order of Android Fragment lifecycle methods: onCreate, onCreateView, onResume, and onCreateOptionsMenu
As a quick “note to self” about the Android Fragment lifecycle, including when the
onCreateOptionsMenu method is executed, I have this debug output from an "Images GridView" in my current application.
The first time I go to the Images GridView:
With all apologies to Google for copying and pasting this block of source code, in my opinion, this simple example is so good at explaining the Android Activity lifecycle so well that it needs to stand out on its own page: