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

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -