Example of creating and switching between two screens


I am looking for an example of how to manage multiple screens. Is there one that shows two screens and how to switch between them.

What MCU/Processor/Board and compiler are you using?

rRF52 with ST7789

What LVGL version are you using?


What do you want to achieve?

I want to be able to have multiple screens and switch between them.

What have you tried so far?

I have tried loading a screen.

I’m still struggling with this. To change from a watch screen which tells time to a different screen, like weather or settings, what is the best way to do this? I saw a response for a tabview, but thats’s not really what I’m doing. There might be many different screens. Do I create multiple screens and use lv_scr_load(scr1)? Is that what this documentation is referring to? Or do I just use lv_obj_clean and rebuild the screen, which I think is what InfiniTime does.

Both options are probably valid. I know for a fact that GUIs made by SquareLine Studio (LVGL editor - (partially) made by the author of LVGL) use e scr_load() function. I would assume that this is the “official” way of doing it.

Is there a simple example of how to create two screens and switch between them?