I'm developing an Android Library module, and I'd like to use Material Design. But if I include my library in another app that uses pre-Material ActionBar
, I got this error:
java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
I am able to make the error disappear only if the 'parent' app also uses a Toolbar instead of an ActionBar, i.e. if it's also themed with Material Design.
I want to allow any app to use this library, no matter what theme they're using.
In my library I included the appCompat lib and made it compatible back to Jelly Bean, according to all the guidelines. Is there some way to prevent the parent app's theme from pervading and demanding the window decor?