Reputation: 27
I'm creating a new Pebble watchface. What I need to do is display some text in a text layer, then after a short delay change it to different text. What's the best way to achive this?
I have tried following:
text_layer_set_text(s_status_layer, "updated");
psleep(1000);
text_layer_set_text(s_status_layer, "ok");
The problem with above is that "updated" is never displayed. Pebble simply keeps displaying whatever text was on "s_status_layer" originally and after 1 second changes it to "ok".
Upvotes: 0
Views: 164
Reputation: 493
Maybe you can use an AppTimer (https://developer.pebble.com/docs/c/Foundation/Timer/) :
AppTimer *updateTimer = app_timer_register(1000, (AppTimerCallback) update_timer_callback, NULL);
void update_timer_callback(void *data) {
text_layer_set_text(s_status_layer, "ok");
}
Upvotes: 2