|   FORUM      |     Tutoriales    |     KIO4 |      
   Start B4A (Basic4Android) App inventor 2 Arduino
   Elastix - VoIP Things of Windows Interesting Webs  Telecomunications

 


Nuevo concurso para España, Argentina, Brasil, Chile, Colombia, Ecuador, México, Perú y Portugal.

App Inventor 2
Programming mobi
le phones with Android 
by App Inventor 2 - Juan Antonio Villalpando

- Initiation Tutorial App Inventor 2 -

Return to tutorial index

____________________________

Storage

54.- Passing data between screens.

ip54_datas_between_screen

- Presentation.

- We could have an application with two or more screens and we need to pass a value from one screen to another, directly we can not do, that is if a we have the variable screen x is 1234, we can not pass that value to another screen.
even on another screen we could have another x with value 6789, which would be different from the previous one .

- The way to pass a value from one screen to another is to use an intermediate element, this element is the basis of TinyDB data. Before moving from one screen to another store a value in the TinyDB and then recovered on the other screen.

- The switch from one screen to another works with emulators difficulty in this case install the application you made ​​on mobile for testing, ie you click on Build to install it on your mobile or tablet.

________________________________________


- In this example we write a name and age in a window. When you press a Button, these data are stored in a TinyDB which is a kind of database, and loads the window 2 (Screen2).
- When the window 2 (Screen) starts, takes data from name and age and calculates the double of age, presented on a Label.
- Pressing the button we can return to the first window.

_________________
Design Screen1

- Insert an TinyDB1

_________________
Blocks Screen1

- Block: open another screen screenName, is in Control .


___________________________________

Add another window, click on Add windows.

_________________
Blocks Screen2

- We set the background color of the Screen2 in yellow to be easily distinguished.

- Insert an TinyDB1
- A Label and Button

Screen2 Blocks.

- Block: Initialize, it is in the part of Screen2 .
- Block: open another screen screenName, is in Control .

Comments

- The TinyDB1 you inserted in Screen1 and Screen2 is the same, so you can pass variables from one to another screen using this common element.

The TinyBD1 is common for the two screens.

_______________________
Proposal

Can you pass two databases from one screen to another?

- Create a screen two bases of TinyBD1 and TinyBD2 data. Various data stored in each.

- Create another screen TinyBD1 two databases and data TinyBD2. Tries to retrieve data from the two bases of the first screen. It's possible?

- You can only spend the last database where we saved on the first screen?

- Can you move, the way we have seen in this tutorial, several TinyDB?

__________________________________

 

- My e-mail:
juana1991@yahoo.com
- Who I am. - Cookies. Texts and images propierty autor:
© Juan A. Villalpando
Not copy texts neither images.
We use our own cookies and third-party cookies on our websites to maintain the session and your preferences, customize your user experience and obtain website use statistics.
Si continúa navegando consideramos que acepta su uso. OK    Más información