Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I also just use the above method of pushing to the screen-stack however an addition to this I also pass references of screens within my stack as parameter to new screens added. If you have any public methods (which might for example update the contents of the screen etc) these can be called from other screens within your stack using this kind of reference. E.g. Screen 1</p> <pre><code>public class MyScreen1 extends MainScreen { private LabelField content; public MyScreen1(){ content = new LabelField(“this is the original content”); add(content); } public void UpdateScreen(String newContent){ content.setText(newContent); } private void PushScreen{ MyScreen2 screen = new MyScreen2( (MyScreen1)UiApplication.getUiApplication().getActiveScreen()); UiApplication.getUiApplication().pushScreen(screen); } } </code></pre> <p>Screen 2</p> <pre><code>public class MyScreen2 extends MainScreen { private MyScreen1 originalScreen public MyScreen2(MyScreen1 originalScreen){ this.originalScreen = originalScreen public MyScreen1 () { LabelField content = new LabelField(“Screen1 will now be changed.”); add(content); UpdateScreen1(); } private void UpdateScreen1(){ originalScreen.UpdateScreen(“This is new content”); } } </code></pre> <p>In this example, once MyScreen2 has been popped, the content of MyScreen1 will have changed. This is useful if you have a scenario where you display details of an object then push an edit screen for the object which would pop back to an older version of the object.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload