MenuItem / JDE 4.5

I created an app for JDE 4.7 and have managed to add menus using the following code:

private class AboutScreen extends MainScreen {
    public AboutScreen() {
        super();
            setTitle(" About");
            LabelField about = new LabelField();
            about.setText("Some text");
            add(about);
    }
}

private MenuItem _aboutItem = new MenuItem("About", 110, 100) {
    public void run() {
        _aboutScreen = new AboutScreen();
        UiApplication.getUiApplication().pushScreen(_aboutScreen);
    }
};

private class HelpScreen extends MainScreen {
    public HelpScreen() {
        super();
        setTitle(" Help");
        LabelField about = new LabelField();
        about.setText("Some text");
        add(about);
    }
}

private MenuItem _helpItem = new MenuItem("Help", 120, 100) {
    public void run() {
        _helpScreen = new HelpScreen();
        UiApplication.getUiApplication().pushScreen(_helpScreen);
    }
};

//create a menu item for users to close the application
private MenuItem _closeItem = new MenuItem("Close", 200000, 10) {
    public void run() {
        onClose();
    }
};

//override makeMenu to add the new menu items
protected void makeMenu( Menu menu, int instance ) {
    menu.add(_aboutItem);
    menu.add(_closeItem);
    menu.add(_helpItem);
}

When I compile the same application using JDE 4.5, the application compiles without any problem. The application runs as well. However, when I select the menus I add (comments or help), I get a "JVM error 104 Eception: IllegalStateException. Once I click on continue, the menu screen appears however the labelField does not work.

Can someone point me in the right direction? I am a new developer to learn the tricks of the trade. Look through the forums, I found nothing useful found in my particular case. I appreciate any input that helps me learn what I am doing wrong.

I don't know what I thought when I started to fill a labelField with text and layout form then she. I should have used a RichTextField from the outset. I changed the labelField for RichTextFields in my two menu items and all is well. No more error JVM 104.

When I said I'm new to application development, I really wanted to say that I am new to application development. I find that what I have learned in my classes of college only takes you so far. You must get your nose to the grindstone and write applications to get the experience to know what works and what does not work.

In any case, I appreciate your comments as well as the entrance, I got Peter.

Tags: BlackBerry Developers

Similar Questions

  • Add MenuItem to a full screen

    Why the following work for screen...

    Showscreen MenuItem = new MenuItem ("Testscreen Show", 40, 40)
    {
    public void run()
    {
    pushScreen (testscreen);
    }
    };
    mainScreen.addMenuItem (showscreen);

    I want to add a narrow menu that closes the application, not the screen. But it does not work for the full screen.  It compiles, but no menu item appears, other than the default menu.

    Fullscreen is not an addMenuItem.  So I used getMenu and add for full screen.

    testscreen = new FullScreen (value, Screen.DEFAULT_MENU);

    Menu TestScreenMenu = testscreen.getMenu (0);
    CloseMenuItem MenuItem = new MenuItem ("close", 40, 40)
    {
    public void run()
    {
    System.Exit (0);
    }
    };
    TestScreenMenu.add (CloseMenuItem);

    JDE 4.7

    Hi JamesColeman,

    Sorry I missed the line that you wanted to close the application, not the screen.

    Yes, close the application, you need to override the onClose method as mantaker suggested.

    I think that your TestScreen class will be something like below:

    public class TestScreen  extends FullScreen
    {
        public TestScreen()
        {
            super(Screen.DEFAULT_MENU | FullScreen.DEFAULT_CLOSE);
    
            VerticalFieldManager vfm = new VerticalFieldManager();
            vfm.add(new LabelField("Test Label"));
    
            this.add(vfm);
        }
    
        public boolean onClose()
        {
            if (Dialog.ask(Dialog.D_YES_NO, "Exit Application?") == Dialog.YES)
            {
               System.exit(0);
            }
            return true;
        }
    }
    

    Concerning

    Bika

  • ApplicationMenuItem called with null in JDE 4.6 when you enter the phone number

    When I install a custom phone app, ApplicationMenuItem and

    try to enter a number on the keypad of the native Dialer, and then click the custom menu,

    my custom ApplicationMenuItem is called with a null context object.

    This same code + test case works well under the 4.5 JDE / 8300 emulator

    and device 8320, but fails under JDE 4.6 with the BB 9000 emulator

    and device

    To reproduce the bug:

    * Build/launch of the attached test application

    * Send with previous key

    * Go to the native Dialer

    * Enter "123" on the keyboard of the phone

    * Click on the trackball

    * Choose Bug49 the context menu

    * It will appear a dialog box indicating "context has the null value - is this a bug?

    NOTE that if, rather than enter a number on the keypad of the phone with step 4.

    a call log is selected, then it works and a non-null context object is passed.

    Can I make it work?  If this is a known bug, are

    It no work around?

    import net.rim.blackberry.api.menuitem.ApplicationMenuItem;import net.rim.blackberry.api.menuitem.ApplicationMenuItemRepository;import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.component.Dialog;import net.rim.device.api.ui.component.LabelField;import net.rim.device.api.ui.component.RichTextField;import net.rim.device.api.ui.container.MainScreen;
    
    public class Bug49 extends UiApplication { public Bug49()    {     super();      Bug49Screen screen = new Bug49Screen();       pushScreen(screen);       ApplicationMenuItemRepository amir = ApplicationMenuItemRepository.getInstance();     Bug49NativeMenu bug49NativeMenu = new Bug49NativeMenu(0);     amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_PHONE, bug49NativeMenu ); }
    
      public static void main(String[] args) {      Bug49 b49 = new Bug49();      b49.enterEventDispatcher();   }
    
       static class Bug49Screen extends MainScreen {     public Bug49Screen() {            super();          setTitle(new LabelField("Hello"));            add(new RichTextField("Hello"));      } }
    
      static class Bug49NativeMenu extends ApplicationMenuItem  {     public Bug49NativeMenu(int order) {           super(order);     }     public Object run(Object context) {           if (context == null) {                Dialog.alert("context is null -- is this a bug?");            }         else {                Dialog.alert("context not null");         }         return null;      }     public String toString() {            return "Bug 49";      } }}
    

    It is a problem in the version of BlackBerry device software 4.6.0.  It has been fixed in version 4.7.0.

  • Wanted themselves CHCI, TR koupila v prodejně kabel k iPhonu, jenže jsem dnes ho dostanu k Vanocům, podivala jsem to do krabičky, ale nesahala na něj, jde to vratit?

    Wanted themselves CHCI, TR koupila v prodejně kabel k iPhonu, jenže jsem dnes ho dostanu k Vanocům, podivala jsem to do krabičky, ale nesahala na něj, jde to vratit?

    I would ask you, today I bought in the store of cable to the iPhone, but I'm going to do for Christmas, I looked in the box, but does not extend, it goes back?

  • SDCard of BB JDE 4.2.1 Simulator.

    Quote from previous forums:

    Comments: Raiden
    SDCard of BB JDE 4.2.1 Simulator.
    Posted the: July 10, 2008 06:32
     
    Hello guys have a good day.
    Little do I need your advice. I want to know how to write the file on card SD JDE on local hard drive. I think that it is possible to do. But I do not know how? Please help me guys.
    Have a beautiful day again"

    msohm

    Messages: 2 239
    Join date: Jul, 2005

    Re: SD of the BB JDE 4.2.1 Simulator.
    Posted the: 10 July 2008 09:37
     
    You try to do to the BlackBery Simulator or a real BlackBerry?

    Mark Sohm
    BlackBerry developer journal
    www.blackberrydeveloperjournal.com

    Comments: Raiden
    Re: SD of the BB JDE 4.2.1 Simulator.
    Posted the: July 14, 2008 21:25
     
    Sorry for answering at the end "I am train to the BB Simulator.
    TNX for your reply ' Makk Sohm

    See the knowledge base article developers below for the steps to set up a micro SD card in the BlackBerry Simulator.

    Use a computer filesystem in the form of microSD card
    DB-00654
    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800738/800792/801083/...

    This feature was added in version 4.2.2 of the BlackBerry Simulator.  So unfortunately it is not supported in version 4.2.1.

  • Add MenuItem icon in Webworks

    Hello...

    I would like to add the image icon to a MenuItem, but I do not know how...
    I do not have any code.

    Please help me... if anyone has code or advice please share...

    Unfortunately not possible with the right WebWorks, you must write a custom extension to do it for you. More details on this here http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Building-a-BlackBerry-WebWorks-J...

    (a list of the currently available API community: https://github.com/blackberry/WebWorks-Community-APIs/tree/master/Smartphone)

  • Code Signing - different version of the JDE

    I'm back-porting an application 4.2 to 4.0. I copied the files sigtool directory 'bin' JDE 4.2 in the 'bin' JDE 4.0 directory. However, when I try to sign the COD files, the operation fails. The 'detail' says:

    "The signature on the request of code signing did not check.  The probable cause of this problem is entered an incorrect password. »

    The password is correct and checked several times. There is another reason for this failure? Am I missing a step when you move files sigtool 4.2 back to 4.0?

    The original JDE (the application was developed on) is 4.2.1. One where I am signing is 4.0.2.

    This link explains the changes in version 4.3.0.  It is the only version of the Pack BlackBerry JDE/component where the format of these files has changed.

    What's – the Signature key format changes in BlackBerry JDE 4.3.0
    Article number: DB-00639

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800738/800989/What_Is...

  • Signature with JDE plugin for Eclipse

    Hello

    Have received my key to sign java applications, I'm a little confused as to how the application is signed.  I don't know if it is correct but I'm clicking on Blackberry, request Signatures, and the signature tool opens. I then click on save and I get the message "unable to save signatures until this application has been registered with all the required powers of signature.  I don't see where I am able to save my application within the JDE.  I don't see my application listed with the status of "unregistered".  Any idea on this would be appreciated.

    Thank you

    I found the solution.

    sigtool.DB and sigtool.csk must be placed in your eclipse plugin directory.  On my system, it's

    c:\eclipse\plugins\net.rim.Eide.componentpack4.3.0_4.3.0.8\components\bin

    G.

  • Impossible to download Blackberry JDE

    Hello

    I am trying to download Blackberry JDE v4.5 for these last two days, but after downloading about 14Mo, Server error is coming. Same is the case with my friend who is also trying to download Blackberry JDE. Is there a problem with the server?

    Thanks for your reply. Waiting for the issue to be decided.

  • problem compiling under JDE 4.6

    I got this error when compile my project 4.3 to 4.6

    C:\Program Research In Motion\BlackBerry JDE 4.3.0\samples\com\rim\samples\device\TestApp\DialScreen.java:159: cannot access net.rim.device.api.ui.component.ListFieldMeasureCallback
    file not found net\rim\device\api\ui\component\ListFieldMeasureCallback.class
    private class MyObjectListField extends ObjectListField {}

    This error can be triggered by the expansion of some areas such as the ObjectChoiceField.  We are aware of this problem and it was reported to our development team.

  • Signature tool does not not on JDE 4.2

    Hello

    I JDE Version 4.2 and 4.5 JDE Version installed. Sign tool only works on JDE 4.5.

    He used to work on JDE 4.2 as well.

    How can I sign the work tool for the two d?

    Thank you

    It would be useful to know what measures you take, and what are the mistakes, if any, that you see.

    The key database format changed with JDE 4.3, so if you have copied your GIS files of 4.5 to 4.2 and then tried to sign with the 4.2 SignatureTool that can fail.  You should just use the SignatureTool provided with 4.5 to do everything what your signature.

    If it is not to describe your environment then please provide additional information.

  • JDE Eclipse plug-in

    Hello

    I write this message for tips and out of my concern for the current state of the eclipse for JDE plugin.

    As a newcomer to the development of blackberry, I tried to optimize a process for the development team to

    make their job a little easier, more specifically, the ability to debug our application in eclipse using the Simulator.  I managed to develop a simple application that I can with ease, call the debugger, however, I would like to know about 2 main problems I've noticed

    (1) be constrained in the CBC for source file

    (2) not be able to include libraries third 3rd in a workspace of blackberry.

    Problem # 1 is not a problem, it of a pain, but not as bad as (2).  As you know, most java applications use the libraries open source by preventing the Constitution of third-party libraries, life becomes very difficult, and I suppose that in some cases, people/companies drop this and move to another platform.

    What I really want to know is - what, work to correct these problems and to deliver a new version anytime soon?

    I hope you are because in its current state, you send a bad message to developers, youenjoy that problems with eclise JDE plugin google see what I mean.  I like to develop for the blackberry, but the lack of a debugger is a pretty serious problem.  Given that both Eclipse and Netbeans are main currents IDE, you will need to accept that most of the people will NOT fall to use your own custom made Java IDE.

    There was on my team talks about moving to another platform and is one of the main factors as bug fixing is a nightmare without a debugger and we have standardized on the use of eclipse.

    If the task to solve this is also very good, why not make it open source and you will have an idea of how much of an issue this is and how much people are willing to invest to make it better.

    If you are any chance to go to the Conference for developers in San Francisco next week, then it would be an excellent opportunity for you to ask in the future for various people on BOARD on the plug-in.

  • ?? Why "MenuItem (String, int, int)" deprecated in 1.3?

    This was annoys me but didn't really think to post so far, in the 1.3 version of the SDK, MenuItem (String, int, int) is marked as obsolete, but there is no other manufacturer for it, then why is it marked obsolete without another manufacturer? So basically in the "Problems" section, I have 'Problems' on all THE MenuItems as warnings for being obsolete, but I've got NO solution for it because there is no other visible manufacturer?

    In addition, in the "javadoc" for MenuItem, that's what it shows

    [QUOTE]

    net.rim.device.api.ui.MenuItem

    Represents an abstract menu item.

    Each element has an ordinal by specifying the sort order in the menu. A separator is automatically inserted between adjacent elements whose ordinals differ at least 0x00010000. Each item has a priority by specifying that one should be the default value. A lower value indicates a higher priority.

    Creating items menu with commands

    Since BlackBerry 6.0 API, you can use command framework API to create a menu item. The procedure is the following:

    1. Set the features to make using a CommandHandler. The order manager can be limited to your application, or can be registered is available to any application on the BlackBerry smartphone.
    2. On your screen, optionally specify the context of the menu item by calling setCommandContext(). The context may be required to determine what should be the command handler.
    3. Associate the menu item to a command by calling setCommand(). The command defines what to run when the menu item is selected by acting as a proxy to an instance of a class that extends a command handler. The command is executed only if there is no implementation of practicable. If the context is specified, it is passed to the command executes the method. Otherwise, this menu item is passed.

    Code example

     class MyUiScreen extends MainScreen
     {
         public MyUiScreen()
         {
           //...
           // Create MenuItem with command context
           MenuItem myItem = new MenuItem("My Menu Item", 110, 10);
           myItem.setCommandContext(new Object()
           {
               public String toString()
               {
                   return "My MenuItem Object";
               }
           });
           // Set command to be invoked by the MenuItem
           myItem.setCommand(new Command(new DialogCommandHandler()));
    
           addMenuItem(myItem);
         }
    
     // A CommandHandler implementation which will be executed unconditionally
     class DialogCommandHandler extends CommandHandler
     {
         public void execute(ReadOnlyCommandMetadata metadata, Object context)
         {
             Dialog.alert("Executing command for " + context.toString());
         }
     }
    

    Creating menu items by subclassing and by implementing Runnable

    If subclassing the extension class must implement the Runnable interface that supports in turn Expedition summary of actions from the menu during activation.

        ...
        // setup the menu items
        MenuItem item = new MyMenuItem();
        menu.addItem(item);
        ...
        class MyMenuItem extends MenuItem {
            MyMenuItem() {
                super(MyResourceBundle.getBundle(), MyResource.MY_MENU_ITEM, 0, 100);
            }
            public void run() {
                // do something
            }
        }
    

    [/ QUOTE]

    StringProvider: "Provides a string that can be changed. The most common use would be for locale changes. "If you hard-code the channels then it is useless, if you use a resource bundle then it is great because you simply provide the family resource and ID to the creation and the rest is handled internally.

  • Version number in "Application Properties" does not match what I put it in in 'Version' on JDE

    I created an application and it is at version 0.9.4.  I put this version number in the JDE under project properties.  This version number is also shown on the screen to start the application.  I create and sign the application.  I send the files .jad and .cod of have downloaded them on our web page.  When I go to our page on my blackberry, it shows that the version is the 0.9.1.  When I install this app, "Application Properties" displays 0.9.1 but the application itself 0.9.4.  I see in the file .jad says 0.9.1.

    How can I match them?  Can I just change this part of the file with a text editor .jad to the current version?

    What version of BlackBerry JDE do you use?  There is a problem in some older versions, where it is not updated the version number in the JAD file.  To work around, you can manually update the version of the JAD file or remove the JAD file, forcing the BlackBerry JDE to recreate when it built your application.

  • How to write a program that allows an HTTPs connection to the APACHE TOMCAT server in blackberry JDE

    Hello.. I am very new to the blackberry JDE environment. But then, I have a project in which I should write a program that will make an HTTPs connection to the apache tomcat server using blackberry JDE. The simulator which I use is 8330-JDE.

    Here is my code...

    import java.io.IOException;

    Import java.io.InputStream;

    Import javax.microedition.io.Connector;

    Import javax.microedition.io.HttpsConnection;

    Import net.rim.device.api.ui.UiApplication;

    Import net.rim.device.api.ui.container.MainScreen;

    public class Httproto extends UiApplication

    {

    public public static void main (String [] args)

    {

    Httproto instance = new Httproto();

    instance.enterEventDispatcher ();

    }

    public Httproto()

    {

    pushScreen (new HttpsConnectionScreen());

    }

    }

    final class HttpsConnectionScreen extends screen

    {

    public HttpsConnectionScreen()

    {

    HttpsConnection c = null;

    InputStream is = null;

    int rc;

    try {String url =

    "https://192.168.2.3: 8443/cit/j_acegi_security_check? j_username = sanogo & j_password = redhat;

    c = (HttpsConnection) Connector.open (url);

    c.setRequestMethod (HttpsConnection.POST);

    System.out.println ("connection is open with the server");

    Get the response code is open the connection,

    Send the request and read HTTP response headers.

    The headers are stored until asked.

    RC = c.getResponseCode ();

    System.out.println ("response from the server" + rc);

    if (rc! = HttpsConnection.HTTP_OK) {

    throw new IOException ("HTTP response code:" + rc);

    }

    is = c.openInputStream ();

    Get the ContentType

    The string of type = c.getType ();

    The length and process data

    int len = (int) c.getLength ();

    if (len > 0) {

    int actual = 0;

    int BytesRead = 0;

    byte data = new byte[len]; while ((bytesread! = len) & (real! = - 1)) {

    real = is.read (data, bytesread, len - bytesread);

    bytesRead += real;

    }

    } else {}

    int ch;

    while ((ch = is.read (())! = - 1). {

    }

    }

    } catch (ClassCastException e) { throw new IllegalArgumentException ("not a HTTP URL");}

    }

    catch (IOException ioe) {}

    finally {

    Try

    {

    if (is! = null)

    is. Close();

    if (c! = null)

    c.Close ();

    }

    catch (IOException ioe) {}

    }

    }

    }

    When I run this program in the Simulator, I can do nothing. Please correct me if I'm wrong in coding.

    As I am new to this blackberry JDE environment, ideas and suggestions on how to write and run the sample applications in the blackberry are more welcomed.

    Concerning

    Hinduja

    Make sure that your MDS starts when the Simulator starts.  In the JDE will in Edition > Preferences > Simulator > General and click the checkbox "launch Mobile Data System connection with Simulator Service.

Maybe you are looking for