I put a couple of breakpoints in onCreate
(one at the beginning, and one at the end of the method), and I also put one at the beginning of onCreateOptionsMenu
. The onCreate
method is called first, and before it finishes onCreateOptionsMenu
is called.
I'm trying to separate the Fragment
navigation code in my app, so I have a couple of objects that I delegate onCreateOptionsMenu
to depending on if the app is running on phone/tablet (I'm using screen size to determine this, my layout file for large screens has a View I check for after the layout is inflated). The problem I'm having is, I create these objects in onCreate, and I'm getting a null pointer exception when I reference the object in onCreateOptionsMenu
.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…