open new form from a current screen

Hi, I'm new to blackberry.

I have 2 files: screen1.java and screen2.java.

in screen1.java:

 
import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.MainScreen;

public class Screen1 extends UiApplication{

    public static void main(String[] args)    {        Screen1  screen1 = new Screen1();        screen1.enterEventDispatcher();    }    public Screen1()    {        pushScreen(new Screen1Screen());        Screen2 screen2 = new Screen2();        screen2.enterEventDispatcher();    }}final class Screen1Screen extends MainScreen{

    public Screen1Screen()    {        super();         setTitle(new LabelField("Screen1"));    }

}

in screen2.java

import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.container.MainScreen;

public class Screen2 extends UiApplication{

    public Screen2()    {        pushScreen(new Screen2Screen());    }}final class Screen2Screen extends MainScreen{

    public Screen2Screen()    {        super();         setTitle(new LabelField("Screen2"));    }

}

I get the exception error: Application is already running in this process.

What I am doing wrong? I want to open screen1 screen2.

"I'm new to blackberry." - Welcome aboard

To answer your question, the problem is that you seem to think it is the instruction

"enterEventDispatcher();"

that allows the new screens to be pushed.  This is not the case, the enterEventDispatcher is just a bit of magic that you have code in the application to get going and you code only once.  You will better understand the latter, for the moment, just code and continue.

I've updated your code in such a way that I think will work (but it is not tested and may not even compile).  I've also renamed things in a way that I hope will clearly be their function.  This will display the screen 1, and when you enter the screen 1, it will take you to the screen 2.  I pasted it below.  It will be useful.

As a beginner, I recommend that you spend some time familiarizing yourself with the resources available of

www.BlackBerry.com/Developers

and this sticky thread

http://supportforums.BlackBerry.com/Rim/Board/message?board.ID=java_dev&thread.ID=13264

import net.rim.device.api.ui.component.LabelField;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.system.Characters;

public class StartUp extends UiApplication {

    public static void main(String[] args) {
        StartUp theApp = new StartUp();
        theApp.enterEventDispatcher();
    }

    public StartUp() {
        this.pushScreen((new Screen1Screen());
    }

}

final class Screen1Screen extends MainScreen
{
    public Screen1Screen()
    {
        super();
        setTitle(new LabelField("Screen1"));
    }

    protected boolean keyChar(char character, int status, int time) {
        switch (character) {
            case Characters.ENTER:
                this.pushScreen((new Screen2Screen());
                return true;
            default:
                return super.keyChar(character, status, time);
        }

    }

}
final class Screen2Screen extends MainScreen
{

    public Screen2Screen()
    {
        super();
        setTitle(new LabelField("Screen2"));
    }

}

Tags: BlackBerry Developers

Similar Questions

  • FRM-92101 happens when I open one form from another and then close it.

    FRM-92101 happens when I open one form from another, check something, display a message to the user and exit the screen to the previous shape.

    Version of forms: 10.1.2.0.2. Java: 1.6.0_23. Browser: IE6

    When I put forward two messages of 'EXIT_FORM', all right and the second form is closed again to the first shape just like I wanted.
    In 9.0 forms, it did not.

    It has to do with the fact that I use JRE instead of JInitiator?
    Thank you.

    Take a look by using the built-in NAME_IN forms. You will find the NAME_IN function takes a STRING as parameter. Change your code to:

    IF NAME_IN('SYSTEM.CURSOR_ITEM') IS NOT NULL THEN
       SYNCHRONIZE;
    END IF;
    

    Hope this helps,
    Craig B-)

    If someone useful or appropriate, please mark accordingly.

  • How can I open my PC from a black screen?

    How can I open my PC from a black screen with the only option of strike F1 or F2 to go to set up. I have tried F11 etc but PC just bleeps?

    Hi James 1001 yr,

    ·         Did you do changes on the computer before the show?

    I suggest you to consult the article in the Microsoft Knowledge Base and check.

    Computer stops responding with a black screen when you start Windows XP

    http://support.Microsoft.com/kb/314503

    Let us know if that helps.

  • New forms from scratch: preferred form design program?

    I know that Adobe products specialize in Microsoft or HTML documents to PDF conversion.


    But what about new forms from scratch?  You use drag and drop builders of form made by third parties or do you use Adobe products?  What is your favorite for the construction of simple forms of the two columns layout?  Please be specific.  Curious to see what products you use to design new forms.

    After hours of research, I've answered my own question.

    Adobe LiveCycle Enterprise Suite 4

  • Installed a new button from the home screen, I shouldn't have to update software?

    Hello

    My home screen button and screen had cracked and I've just fixed. I was told by the repair iphone specialist do not update my phone more because the phone could brick because of the new button on the home screen that has installed.

    My impression fingerprint sensor works now more for the phone this new button.

    With an update, a software update will brick my phone? I'm on version 9.2.

    Thank you

    Unless your screen was repaired by Apple or an Apple authorized repair center, it will not work properly again. The ID of touch will not work. At this point, so you should not try to update of iOS, as this will brick your phone.

  • I can't open new tabs from file - only open a new window or tab strip

    For awhile, I was not able to click on a tab plus sign to open a new tab, not even by going to the file menu. I even reset Firefox to my default settings, it sets itself for a short period while today ', then back to the not not to work again! The only time that I can open a new tab is if I am on a site and I right click to open a new tab, if not to open another window, I have to go to file and open a new window, the tab no!

    The Ask toolbar is originally only in versions of Firefox 3.6.13 +. Uninstall this extension.

    There are a few places to check for the Ask toolbar:

  • How can I create a new form from scratch online?

    I'm unable to create a new online starting from scratch as the software asks me to use a template, but when I click the link it says page not found. I use Adobe Acrobat X Standard. Help, please

    Hi michellem44243306,

    You can view the following link to create a form on Adobe Acrobat X Standard: Adobe Acrobat X Pro * create forms using Acrobat

    It contains the steps and the video tutorial for a better understanding.

    In the case where you are still having a problem please lets us know.

    Kind regards

    Nicos

  • Open the form in one new window from another

    Hello
    I have the module for departments and one for employees
    and I push botton, I need when_button_pressed to open the form used in the new window (to display employees in this Department)
    I used this code
    OPEN_FORM ('Employees')
    but it gives me an error: FRM-30203: no element on the block EMPLOYEES.
    FRM-30407: block must have at least one data element.
    Block: EMPLOYEES
    FRM-30113: block must only have point database non-requetes.
    Block: EMPLOYEES

    Form created file C:\Users\m\Desktop\New Folder\MODULE1.fmx

    and when I click on the button I have error THAT FRM-40010 cannot read employees

    any help would be appreciated

    If I understand correctly, you have a form with departments and employees of two blocks, and you want to open a second block of the first in a new window?
    If I know open_form's between other modules no blocks.
    go_block but it's the same window.
    You can check show_window()

  • After the opening and reading of a new email from Windows Mail Inbox, it disappears

    After the opening and reading of a new email from Windows Mail Inbox, it disappears the next I open Windows Mail or switch to another folder and back to the Inbox! Please advise!

    View | Current view. Make that sure show all Messages is checked and nothing else. (Like hiding Messages).

  • How to open a new tab from the address line?

    How to open a new tab from the address line?

    You will need to hold down the ALT key and press ENTER to open the link in a new tab without the use of an extension cord.
    By default the links always open in the same tab.

    You can search the Addons site for an extension if you want to change this default behavior.

  • How can I get a query in the search field to open in a new tab or a new window, and the current window?

    How can I get a query in the search field to open in a new tab or a new window, and the current window?

    If you are looking through the search bar in the Navigation toolbar, this preference can be changed to research it open in a tab.

    Type of topic: config in the address bar and press ENTER. Then answer "I'll be careful." Type this pref in the search at the top.

    Browser.Search.openintab = double click to switch to true

  • Firefox 5.0.1 open Web site automatically to a new tab from time to time which is very annoying

    I have Firefox version 5.0.1 on MS windows XP. My problem is that Firefox opens a Web site automatically in a new tab from time to time, which is very annoying.
    I scanned my computer against virus and malware using a lot of programs, but this has not fixed this annoying problem.

    Web sites that open automatically are:

    - http://www.netadfusion.info/r.php
    - http://www.humananatomycourse.com/
    - http://www.lonelylonelylonely.com/
    

    No idea how to solve this problem?

    you have installed net Cup Defender I guess was completely uninstall it and the browser hijack check that you have removed the following files.

    • Itemc:\Documents and Settings\All Users\Menu bulleted list

    Arcai.com\netcutdefender help.url Menu\Programs\

    • ItemC:\Documents and Settings\All Users\Menu bulleted list

    Arcai.com\netcutdefender.lnk Menu\Programs\

    • ItemC:\Documents and Settings\All Users\Menu Menu\Programs\arcai.com\Uninstall bulleted list

    netcutdefender.lnk

    • ItemC:\Documents and Settings\All Users\Menu bulleted list

    Menu\Programs\arcai.com------www.arcai.com.url

    • ItemC:\Documents and Settings\All Users\Menu Menu\Programs\WinPcap\Uninstall bulleted list

    WinPcap 4.1.2.lnk

    • ItemC:\Documents and Settings\All Users\Menu Menu\Programs\WinPcap\WinPcap Web bulleted list

    Site.URL

    • ItemC:\Documents and James Data\Microsoft\Internet bulleted list

    Explorer\Quick Launch\Arcai.comof Netcut - Defender.lnk

    • ItemC:\Documents and Settings\James\Desktop\netcutdefender Seekmo bulleted list
    • ItemC:\Documents and Settings\James\Desktop\NetcutDefender.lnk bulleted list
    • ItemC:\Documents and Settings\LocalService\Favorites\Desktop.ini bulleted list
    • ItemC:\Program Seekmo bulleted list
    • Bulleted itemC:\Program
    • Bulleted itemC:\Program
    • Bulleted itemC:\Program
    • Bulleted itemC:\Program
    • Bulleted itemC:\Program
    • Bulleted itemC:\Program
    • Bulleted itemC:\Program
    • Bulleted itemC:\Program
    • Bulleted itemC:\Program
    • Bulleted itemC:\Program
    • Bulleted itemC:\Program
    • Bulleted itemC:\WINDOWS\is-NAN8L.exe
    • Bulleted itemC:\WINDOWS\is-NAN8L.lst
    • Bulleted itemC:\WINDOWS\is-NAN8L.msg
    • ItemC:\WINDOWS\Prefetch\PRA bulleted list. EXE - 2FE32670.pf
    • ItemC:\WINDOWS\Prefetch\NETCUTDEFENDER bulleted list. EXE - 00ADBCA2.pf
    • ItemC:\WINDOWS\Prefetch\NETCUTDEFENDER bulleted list. EXE - 2CCAA66B.pf
    • ItemC:\WINDOWS\Prefetch\NETCUTDEFENDER bulleted list. TMP - 07E4DB34.pf
    • ItemC:\WINDOWS\Prefetch\WINPCAP bulleted list. EXE - 31529284.pf
    • Bulleted itemC:\WINDOWS\system32\activepacket.dll
    • Bulleted itemC:\WINDOWS\system32\actskn43.ocx
    • Bulleted itemC:\WINDOWS\system32\drivers\npf.sys
    • Bulleted itemC:\WINDOWS\system32\Packet.dll
    • Bulleted itemC:\WINDOWS\system32\pthreadVC.dll
    • Bulleted itemC:\WINDOWS\system32\wpcap.dll

    This will stop and remove netcut and the problem of redirection.
    I tested in vmware and I sent the guy who did netcut and also posted it on cnet downloads.

    No antivurs or malware program it will pick up, I think that it down to the activepacket.dll

    This guy mentions the http://www.allmoreinfo.com/wow-netcut-defender-2-1-2-with-new-feature.html down problem

  • When I click on an e-mail on a web page, I want that it open / compose new messages in GMAIL (currently it uses Windows Live Mail). How do I?

    When I click on an e-mail on a web page, I want that it open / compose new messages in GMAIL (currently it uses Windows Live Mail). How do I?

    See this:

    http://support.Mozilla.com/en-us/KB/changing+the+e-mail+program+used+by+Firefox

  • How can I open a new window without the current tabs being replicated?

    I have a window open with several tabs. I open a new window and the current tabs are replicated - I'm waiting for the new window empty - what am I doing wrong? Should what settings I change. I'm running Firefox on a MacBook Pro with Snow Leopard OS.

    This has happened

    Each time Firefox opened

    Firefox support Home page (s) by default in a new window.
    If you see something else, then check your extensions (Tools > Modules > Extensions) to see if one of them is the cause.
    See Troubleshooting extensions and themes and problems of hardware acceleration to resolve common Firefox problems

    How to open this new window?

  • After the response failed to ema joining photos, l had opening of 'problem'... "" try again "screen but now cannot open new screen msg at all for the new message or a reply. Access always able recd emails. Vista 32

    After response failure attaching pictures to the email received, l had opening of 'problem'... "" try again "screen but now cannot open new screen msg at all for the new message or a reply.
    Hope I'm doing this right - tried restar, apparently seeking the answers and by publishing this request elsewhere. Appreciatte guidance!

    Hi Mike,.

    You are welcome. If you have any other questions, you can always report to Microsoft Answers.

Maybe you are looking for

  • Once Windows vista opens, and I try to choose a program from the computer freezes.

    I have A Gateway P-7811FX and every time I restart the laptop it freezes. Everything started after battery ran to 10% and automatically shut down the pc. I tried to restore from 2 days before delivery, but I just get an error message saying: could no

  • ISA-570W behind router 1921

    Hi all We just bought a 570W ISA.  I have a router in 1921 that we use for our DSL connection.  Basic configuration on 1921 only for the DSL connection and pass-through.  How do you get the NATTING on ISA to allow internal users internet.  External i

  • Stopped Services in Msconfig - means that a virus is on my system?

    In the starting area, went into msconfig, who took me to the Configuration of the system, where I clicked on Services.  During the opening, there was a long list of entries, which most had a 'Running' status, but 76 listings had a marked status "Stop

  • Problem with Captivate 9 preview

    Working on a sensitive project today, I found that all of a sudden there is a problem with the image previewed.  The normal reactive screen does not appear and instead, I get a preloader icon which never completes.I tried all the options - next 5 sli

  • The cluster parameters

    We have a situation where vmkping has suddenly stopped working in a cluster between different hosts. two other groups in the same data center and closing works very well.I need a script to get all setting DRS, HA setting of all three groups to compar