How to send value when back.pressed

I am testing a small music selection app.

I have 3 screens.

Screen 1 has the singers' choice. when the singer button clicked. the app opens screen 2 with the singer's name as start value.

Screen2 opened and list the songs according to the start value singer.
When the song clicked, the app opens Screen 3 and then open the youtube to play the song by the webviewer.

problem is when I close my screen3 and back to Screen2, I am not able to send the singer's name as value. so when i go back to screen 2 , there is no song selections showed.

I have read the documentation of close screen with value...I am not sure I understand...but from my test , it seems only sending the value same as the one opened screen 3 .

How should i do it to make it work?

attached my apk as below

Thank you very much for help.

Sounds like you need to send the singer's name to Screen3 as a value, so that you can send it back to Screen2, in the same way you send it from Screen1?

Alternatively, use a tinydb to save the singer's name, then it can be available in all screens - you need to load a tinydb to each screen.

If you are using the device's backpress key (triangle) there is an event block for this:


In my screen3 , I wrote below code, why can't i send the singer name?

Screen3 only sent its start value (which is a number),back to screen 2......

@TIMAI2 is it possible to send customized value when backpressed?

Did you test this with a compiled app (apk) ?

For testing in companion, it may be easier to use the tinydb to store values across screens....

TinyDB example of the same thing:

Unless you only intend to have a limited number of songs/artists, this will very quickly become difficult to manage with lots of artists and songs, you should consider using lists and indexing for selection.

Thank you @TIMAI2.

I have tried Tiny DB, it all works out.




This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.