Dynamic text overlapping

HI everyone,
I am trying to update the label text of counter value from 1-100 but i am getting the text value which is overlapping to each other. Here is the steps which i am following .

lv_task_create(label_refresh_task, 900, LV_TASK_PRIO_MID, NULL);
int battery_per = 0 ;
void label_refresh_task(void *args)
{
static int start = 0;

if(start_flag == 0) {
battery_per = lv_label_create(lv_scr_act(), NULL);
lv_obj_set_pos(battery_per, 180, 35) ;
start_flag = 1 ;
}
sprintf(per, β€œ%d”,battery_per) ;
strcat(per, β€œ%”);
lv_label_set_text(battery_per, per);
memset(per, β€˜\0’, sizeof(per));

}
I am getting the incremented value of battery_per but this incremented value is overlapping with old display value like 0-1-2-3 …

Please give me any suggestion on this .

Thanks,
rakesh

1 Like

You don’t need to create a new label each time. Just change the value on the existing label.

Thank you ,
Its because of label creation each time in loop.Now its resolved.

Thanks,
Rakesh