show form from code

41 views
Skip to first unread message

Sam Ace

unread,
Apr 26, 2014, 7:32:13 PM4/26/14
to codenameone...@googlegroups.com
hi guys. i built a form via designer but i want to show the form from my code... hw do i go about this?

Shai Almog

unread,
Apr 27, 2014, 12:39:52 AM4/27/14
to codenameone...@googlegroups.com
Hi,
showForm("formName", null);

Sam Ace

unread,
Apr 27, 2014, 5:05:10 AM4/27/14
to codenameone...@googlegroups.com
i tried that but the form which i need redirection to loads before the splash is shown so all i have is the splash not the form i wished for. maybe you should take a loo at my code and see where i went wrong


@Override
    protected void onCreateSplash() {
    String strLogged = (String) Preferences.get("logged", null);
     if(strLogged == null ){
        // Dialog.show("Reg", "Not member yet", "ok", "cancel"); // means user is lunchin app for first time
         showForm("LoginForm", null);
         Preferences.set("logged", "false");
        
     }else{
        
         if(strLogged.equals("true")){
           
             showForm("MainForm", null);
             Preferences.set("logged", "false");
         }else{
             showForm("LoginForm", null);
             Preferences.set("logged", "false"); // user isnt logged in
         }
     }
      
    }

Shai Almog

unread,
Apr 27, 2014, 2:40:34 PM4/27/14
to codenameone...@googlegroups.com
If you want to replace the very first form of your application override getFirstFormName() and return the name of the form you want to show first based on your settings.

Sam Ace

unread,
Apr 27, 2014, 9:18:53 PM4/27/14
to codenameone...@googlegroups.com
thanks shai.. i guess my problem was i used before show on splash to call a form. thats why i saw a form before the splash so i changed to post show on splash and it works fine now. thanks
Reply all
Reply to author
Forward
0 new messages