How can I make a refresh button?


i'm just a starter and i have a screen , and i need to make a button when i press it it refresh the screen ..

thanks in advance

Hi @Aly_Hassan Welcome
You can do this by two methods:
1.Resetting all variables,values and properties
2.Reopening the screen

1 Like

Thanks for your kind respond , but as i told you before i'm just starting my 1st application today , can you please show me the way ..

You can use this to open any screen:


In above example it will close the current screen and open Screen1.
In fact this method is used to correctly switch screens to avoid OOM or Invalid Window Token error.


I will try it , Many thanks my friend


Many Thanks :slight_smile:

Wow, this is a new logic.
Can I make a tutorial topic with this logic, or you can create one

1 Like

Not so new.

The tutorial is already available

Okay, I'm sorry :sweat_smile: :+1:

1 Like

Tried this code to refresh my screen. Did not work during testing :worried:
Or does it work only when compiled into an apk?

Sorry did not work for me :worried: I just need to reset my screen the way it happens when you click 'Refresh companion screen' after connecting via the AI companion. Any suggestions?

Yes, that only works with the APK, because otherwise Companion would have to be closed (and restarted).


Close Screen block / Close Application block does not work on emulator

(added to FAQ)

because it addresses Screen1 opening.


Yes it will not work in Companion.
Since you can't close companion app so close screen block does nothing here.
You will have to compile the app.

Thank you, Anke, Anup, ABG and vknow360. Will test in the apk

thank you so much :heart_eyes:

1 Like