title: How to use "setTextColor(hexaValue)" on Kotlin for Android,
body: <h2>Background</h2>
  
  <p>In Java, I could directly change the text color of a TextView, using the standard hexa-decimal value of it:</p>
  
  <pre><code>    textView.setTextColor(0xffffffff); //white
      textView.setTextColor(0x00000000); //transparent
      textView.setTextColor(0xff000000); //black
      textView.setTextColor(0xff0000ff); //blue
      //etc...
  </code></pre>
  
  <p>Very easy...</p>
  
  <h2>The problem</h2>
  
  <p>On Kotlin, if I try to write such a thing, I get with a weird build error:</p>
  
  <blockquote>
    <p>Error:(15, 18) None of the following functions can be called with the
    arguments supplied: public open fun setTextColor(p0: ColorStateList!):
    Unit defined in android.widget.TextView public open fun
    setTextColor(p0: Int): Unit defined in android.widget.TextView</p>
  </blockquote>
  
  <h2>What I've tried</h2>
  
  <p>I tried to search about this over the Internet, and I couldn't see anything special about hexa-decimal values. Seems the same like on Java:</p>
  
  <p><a href="https://kotlinlang.org/docs/reference/basic-types.html" rel="noreferrer">https://kotlinlang.org/docs/reference/basic-types.html</a></p>
  
  <p>Then I decided to just write in Java, and convert to Kotlin. The result is very unreadable in terms of the color value:</p>
  
  <pre><code>    textView.setTextColor(-0x1) //white
      textView.setTextColor(0x00000000) //transparent
      textView.setTextColor(-0x1000000) //black
      textView.setTextColor(-0xffff01) //blue
  </code></pre>
  
  <p>To me it seem that the hexadecimal value of Integer that is used for Kotlin is signed, while on Java it's converted to signed one automatically, so this causes flipping of values and the need to set a minus sign when needed.</p>
  
  <p>The only thing I can think of, that still allows to read it well, is something like this:</p>
  
  <pre><code>textView.setTextColor(Integer.parseUnsignedInt("ffff0000",16));
  </code></pre>
  
  <p>However, this has multiple disadvantages:</p>
  
  <ol>
  <li>It is way longer.</li>
  <li>It converts a String, so it's much less efficient</li>
  <li>Most importantly: it works only from API 26 (Android O) , which currently is active on about 1% of Android devices worldwide.</li>
  </ol>
  
  <h2>The questions</h2>
  
  <p>Why does it occur?</p>
  
  <p>What exactly can I do to make it the most readable, without string conversions, and work on all Android versions (minSdkVersion 14 in my case) ? </p>