Java Question Unicode characters b4a->java-library

DonManfred

Expert
Licensed User
Longtime User
Hello,

in one of my library i need to set a unicode character (it is a icon from a iconfont)
for ex
B4X:
btn.setIconResource("\uf17b");
In this case it works. But the string is hardcoded into the library.
If i want to give this "string" from b4a to the java-lib
B4X:
button.SetIcon("\uf17b")
then it is a normal string with the content \uf17b
and the icon is not set correctly.

What do i need to change to get this in java to work? Or i mean; what do i need to give as the value?

Edit:

I´ve tried to create a map with all Icons from the ttf font

B4X:
  iconmap = new HashMap();
        iconmap.put("fa-android",  "\uf17b");
[..]
    if (iconmap.containsKey(iconres)==true){
       BA.Log("Iconres found in map => "+iconmap.get(iconres));
       String s = (String)iconmap.get(iconres);
       btn.setIconResource(s); // "\uf17b"
     }else{
       BA.Log("Iconres '"+iconres+"' NOT found in map");
     }
but this does not work either. What i am doing wrong?
 
Last edited:
Top