How I can get Screen name as a value

When opening the screen from another, pass the previously-open screen's name as a start value.
During the BackPressed event, compare the content of the start value.

1 Like

Hi NishyanthKumar,
I previously-open screen I have start value to open certain page in ScreenWebViewer (Screen name is Website).


Where and how I put startValue of this Screen (we can name it Screen2)?
And where/how I compare this in BackPressed event?
I know that it could be a silly question, only in this moment I can`t see how it could be done.
For :AyProduction : I must have possibility be back from page to page in WebViewer not only close the Screen.

Why did you use the if then block?

To open another screen with data stored in tinydb and close this screen. In this way only one screen is open.
I think.

But there is still no function of it.
(sorry if it's off-topic)

It`s works many years. Maybe something was change but I go the old way.

http://puravidaapps.com/manager.php
https://community.appinventor.mit.edu/t/opening-another-screen-and-closing-the-current-one/70922/6 see Anke response.

The 'if then' is completely spurious - try the block with that 'if' removed.

I will be back to my main question.
"How do that the "BackPressed " procedure should return to the screen where the query came from, i.e. to screen 1 or 2."
How I put "dynamic" value to this block:


NishyanthKumar suggested to put Screen name in a start value (of Screen1 or Screen2) and then compare content during BackPressed event. But I can`t see in which place and how to do this.
In the Webview screen I want keep this possibility to working on Internet pages and going back to Screen1 or Screen2.

In that case, you might try this:


(I don't guarantee you that this would work though)
Also, I didn't use procedure cuz I still don't understand why you need it. You might use it if you want.

Firstly, the dynamic value - when 'Screen1' opens 'ScreenWebsite', it can pass the number 1 to 'ScreenWebsite' and similarly 'Screen2' can pass number 2.

However, this is not necessary. You can simply use the Close Screen Block and the User will be returned to the Screen that most recently opened 'Screen Website'.

It opens a 2nd instance of Screen1, which will eventually cause the App to crash.

2 Likes

But it's not crashing for me, and it's working fine
Here's the aia. :
web.aia (3.8 KB)

It depends on the over-all memory allocation for the App how large/sophisticated the screens are and how long the App is run.

Just because you can drive your car on 3 wheels instead of 4, should you?

It was happen and will happen again :wink: so in this ChrisWard is right. For this normally I close every Screen first to pass to another.
In your aia you pass start value Screen name, but in my case I pass web page address. I cant see place to put another start value. ChrisWard how I can pass these numbers and read them in BackPressed event. Can you show some block. As I said I fill blocked and I cant see how. I know that this is something simple.
I use these blocks to have possibilities to work inside web page:


if not hole Screen will be closed. I think. If I remember what happened once.

Give me 10 minutes to make a simple example

Try this, it's rough, but the basic requirement for reliability is there.

ChangeScreens.aia (4.5 KB)

Yes this blocks work. But. Try navigate in this open page. If you choose back you don`t be back to previous page but close the Screen.
I will try this:


and tell what happen.

You do not need to be concerned with CurrentUrl v HomeUrl, the Url displayed is always the current one when the ScreenWebsite is opened. Therefore, there is only one web page displayed and WebViewer1.GoBack is not required (has nothing to go back to).

So in Companion is not going back / or close screen with block I used but navigation is possible. I will try install apk.

OK after installation is so that. With block I insert navigation on Internet in Screen is possible but closing Screen is giving blank page. Its an old problem. But Im looking to have both, navigation and "BackPressed".
So probably I must find way around. Only I don`t see how.