Yep Yep - 3 months ago 27
Android Question

Must be one or more of "getSupportActionBar().setDisplayOptions..."

I've had this line in my code for a while now:

getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_SHOW_CUSTOM);


I recently updated to
compileSDKversion 23
, and after that I started getting this error:


Must be one or more of 'getSupportActionBar().setDisplayOptions...


And then it gives me a list of the possible options.

Does this mean anything bad will happen in my code? Have I done something wrong? Is there any fix?

Thanks!

Answer

Change:

import android.app.ActionBar;

to:

import android.support.v7.app.ActionBar;

You are using the appcompat-v7 action bar backport; you need to use the right ActionBar import for that to work.