Search code examples
javascriptandroidunicodetitaniumtitanium-mobile

Unicode Character 'BULLET' in Titanium App


I have a problem with the BULLET character in my Android App developed with Titanium.

I have this part of code:

    function getFormattedPizza()
{
    var text = win.crust + ' pizza with:\n';
    if (win.toppings.length == 0)
    {
        text += '• Plain (cheese pizza)\n';
    }
    else
    {
        for (var i = 0; i < win.toppings.length; i++)
        {
            text += '&bull; ' + win.toppings[i] + '\n';
        }
    }
    return text;
}

and in my app I see the string &bull ; Plain (cheese pizza), not an unordered list.

In that way I can show a dots list?


Solution

  • instead of &bull you can use the '\u2022'+'Plain (cheese pizza)', \u2022 is the unicode for bullet.

    Samlple code :

    var lbl = Ti.UI.createLabel({
        text : '\u2022'+' HELLO'
    });
    win.add(lbl);
    

    For more unicodes you can check this Link, or refer to this question.

    Hope this will help you. :)