I was a browsing a piece of code(android.app.Activity.java
) and I found a method call,
public void invalidateOptionsMenu(){
if (mWindow.hasFeature(Window.FEATURE_OPTIONS_PANEL) &&
(mActionBar == null || !mActionBar.invalidateOptionsMenu())) {
mWindow.invalidatePanelMenu(Window.FEATURE_OPTIONS_PANEL);
}
}
Now, this is not a question that pertains specifically to Android but a question related to Java and the IDE. I am using Android Studio and it shows this method call in red with message, "Cannot resolve method invalidateOptionsMenu()" but overall there is no error in parsing and compilation of Activity.java.
Not only this method but there are others that are unresolved. I checked mActionBar's type and it is ActionBar. I went to ActionBar.invalidateOptionsMenu()
and method exists.
First, why is the compilation unit being able to be parsed and then compiled even though there are unresolved method calls. Second, even though the method exists(and shouldn't show unresolved), How should this behavior of IDE be interpreted as?
Aucun commentaire:
Enregistrer un commentaire