android - Crash on changing action bar color -


i'm adding

actionbar bar = getactionbar(); bar.setbackgrounddrawable(new colordrawable(color.parsecolor("#0000ff"))); 

to main activity oncreate. app's execution starts, stops responding. doing wrong?

my androimanifest

<application android:theme="@style/apptheme" > 

my styles

<style name="apptheme" parent="theme.appcompat.light.darkactionbar"></style> 

using minsdkversion 21.

assuming using actionbaractivity (as corresponds appcompat theme), should always use getsupportactionbar() instead of getactionbar() - of revision 21, getactionbar() return null actionbaractivity.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -