By Alvin Alexander. Last updated: June 4, 2016
I just ran into an Android problem where neither my ActionBar or menu were showing up. I was trying to create my menu in a FragmentActivity, and in short, you can’t do that. You need to change the FragmentActivity
to an ActionBarActivity
, which (fortunately) is a subclass of FragmentActivity
. A necessary side effect of this is that you end up importing a lot of support library classes, like this:
import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v7.app.ActionBarActivity;
I’ll write more on this in the future when I publish more of my code, but as mentioned, to get my new menu to work in my Android app, I had to change FragmentActivity
to ActionBarActivity
, and when I did the menu and action bar were shown correctly.
Also, the image shown comes from this Android javadoc page.