A Alessandra Pellegri Active Member Licensed User Longtime User Aug 27, 2015 #1 I should convert this Android studio command to B4a: String hexColor = String.format("#%06X", (0xFFFFFF & intColor)); where intColor is a color and hexColor is a string that I should pass to a javascript. How can I do ?
I should convert this Android studio command to B4a: String hexColor = String.format("#%06X", (0xFFFFFF & intColor)); where intColor is a color and hexColor is a string that I should pass to a javascript. How can I do ?
walterf25 Expert Licensed User Longtime User Aug 27, 2015 #2 Alessandra Pellegri said: I should convert this Android studio command to B4a: String hexColor = String.format("#%06X", (0xFFFFFF & intColor)); where intColor is a color and hexColor is a string that I should pass to a javascript. How can I do ? Click to expand... don't know if this thread will help you! https://www.b4x.com/android/forum/t...032x-new-biginteger-1-md-digest-to-b4a.47326/ Walter Upvote 0
Alessandra Pellegri said: I should convert this Android studio command to B4a: String hexColor = String.format("#%06X", (0xFFFFFF & intColor)); where intColor is a color and hexColor is a string that I should pass to a javascript. How can I do ? Click to expand... don't know if this thread will help you! https://www.b4x.com/android/forum/t...032x-new-biginteger-1-md-digest-to-b4a.47326/ Walter
Erel B4X founder Staff member Licensed User Longtime User Aug 28, 2015 #3 You can use this code (depends on ByteConverter library): B4X: Sub ToJSColor(color As Int) As String Dim bc As ByteConverter Dim bytes() As Byte = bc.IntsToBytes(Array As Int(color)) Return "#" & bc.HexFromBytes(bytes).SubString(2) End Sub Upvote 0
You can use this code (depends on ByteConverter library): B4X: Sub ToJSColor(color As Int) As String Dim bc As ByteConverter Dim bytes() As Byte = bc.IntsToBytes(Array As Int(color)) Return "#" & bc.HexFromBytes(bytes).SubString(2) End Sub
A Alessandra Pellegri Active Member Licensed User Longtime User Aug 28, 2015 #4 Thanks, it works!! Upvote 0