Search code examples
androidandroid-layoutsetbackground

Android setBackgroundColor crashes application


This is a piece of code that is working for setbackground color tabwidget

mTabHost.getTabWidget().setBackgroundColor(Color.parseColor("#FFFFFF"));

However when I used different value of HEX: #FFC905, the application crashes.

What am I doing wrong? Android newbie here.


Solution

  • Maybe instead of doing:

    mTabHost.getTabWidget().setBackgroundColor(Color.parseColor("#FFFFFF"));
    

    Try to do :

    mTabHost.getTabWidget().setBackgroundColor("#FFFFFF"));
    

    But the logCat would really help