언어 설정

Menu
Sites
Language
Dynamic change a text label

Hi,

I want to make a change to an UI element and for example change a text label, however I get a segfault instead.


var text = new TextLabel("Hello Tizen NUI World")
{
    HorizontalAlignment = HorizontalAlignment.Center,
    VerticalAlignment = VerticalAlignment.Center,
    TextColor = Color.Blue,
    PointSize = 12.0f,
    HeightResizePolicy = ResizePolicyType.FillToParent,
    WidthResizePolicy = ResizePolicyType.FillToParent
};
window.Add(text);

int i = 1;
new System.Threading.Timer((r) => {
    text.Text = $"Text {i}"; // <--THIS generates the segfault
    i++;
}, null, TimeSpan.Zero, TimeSpan.FromSeconds(5));

Why do I get that segfault and are there other ways to dynamically change text or any other propriety dinamically ?

PS: Instead of this timer, imagine that maybe I have an async web request and instead of a stupid text label imagine that I need to add dynamically items to a list.

Responses

1 댓글
Armaan-Ul- Islam

You might try the Xamarin Developers Forum also, Developers on the specific domain may share their experiences with you there...

https://forums.xamarin.com/