Java Question Unicode characters b4a->java-library

Discussion in 'Libraries developers questions' started by DonManfred, Mar 1, 2015.

  1. DonManfred

    DonManfred Expert Licensed User

    Hello,

    in one of my library i need to set a unicode character (it is a icon from a iconfont)
    for ex
    Code:
    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
    Code:
    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

    Code:
    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: Mar 1, 2015
  2. thedesolatesoul

    thedesolatesoul Expert Licensed User

    What is the signature for setIconResource?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    You can use Chr(0xf17b).
    It is equivalent to "\uf17b"
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice