Search code examples
androidandroid-color

How to set transparent color in Color.parseColor()


I'm using a third-party library for using tooltips. the tooltip has a method .setColor() which uses an integer color value. so I tried doing this:

private int toolTipColor = Color.parseColor("##B2000000");

I get a run time error:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.raunak.alarmdemo4/com.raunak.alarmdemo4.MainActivity}: android.view.InflateException: Binary XML file line #8: Binary XML file line #8: Error inflating class fragment

is there any alternative? for setting a transparent color.


Solution

  • parseColor() expects a single # -- you had two. In your case, it appears that the parser choked on the second #.