Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
XRayCharlie
Posts: 5
Registered: ‎09-15-2008
My Device: Not Specified

MenuItem Test not working

Hello,

 

I am trying to get the menuItem example working on my real blackberry. It works fine on the emulator.

 

I have purchased and installed my keys. I have signed the .cod and it shows as signed.

 

I install it using javaloader and it says the install is successful but the new menuItem is not showing up.

 

I have tried restarting (just in case) without any luck. 

 

Any ideas?

 

Regards. 

Please use plain text.
Developer
rafo
Posts: 507
Registered: ‎07-15-2008
My Device: Not Specified

Re: MenuItem Test not working

Show your code.
----------------
if your issue solved set "Solution" mark at the relevant post
Please use plain text.
Developer
peter_strange
Posts: 19,598
Registered: ‎07-14-2008
My Device: Not Specified

Re: MenuItem Test not working

Can you confirm the JDE Level you are using and the OS Level of the device?  You may not have seen the following:

 

What Is - Appropriate version of the BlackBerry JDE
Article Number: DB-00537

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800901/What_Is_-_Appr...

 

Your startup code could be throwing an exception that you are not seeing (for example, many security exceptions are never seen on the Simulator because it, by default, does no security checking).  After the reboot, check the Exception log using the ALT LGLG key combination and you might see something in there.  Also you could, rather than installing the menu item at startup, have a UI interaction to establish your menu item.  Then install on the device, attach the JDE to debug from the device, put some break points in your code and I'm sure you will quickly determine where the problem is. 

 

Hope this helps.

Please use plain text.
New Developer
XRayCharlie
Posts: 5
Registered: ‎09-15-2008
My Device: Not Specified

Re: MenuItem Test not working

Hello,

 

Constructed a simple midlet and involked the (new MyMenuItem(0)).registerInstance(); from a button press.

The menu item gets added as it should.

 

I'm not seeing and error in the exception log so I'm wondering if the menuItem demo isn't even starting up?

 

Any thoughts as to why it wouldn't be?    

In the properties I have "Auto-run on startup" checked off.

 

Regards. 

Please use plain text.
Developer
peter_strange
Posts: 19,598
Registered: ‎07-14-2008
My Device: Not Specified

Re: MenuItem Test not working

Apologies, I'm not familiar with Midlet applications, so not sure I can help here.
Please use plain text.
Administrator
MSohm
Posts: 14,268
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: MenuItem Test not working

What is MyMenuItem?  What is not running on startup?  Can you provide a code snippet?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
XRayCharlie
Posts: 5
Registered: ‎09-15-2008
My Device: Not Specified

Re: MenuItem Test not working

MyMenuItem is a class in the menuitem example on the development site.

 

It autostarts in the emulator but I cannot get it to start on a real blackberry.

I have signed the code and it installs fine.  I do not see any errors in the event log.

 

The code is as follows:  I changed it a bit (simplified it) so it adds an item to the addressbook list and just displays a dialog when selected.

I see in the samples included with the jde that there is always a seperate project that does the autostart.  I'm going to try something similar to see if that works.

 

Regards. 

 

//--------------------------------------------------------------------------------------------------

package com.rim.samples.menuitem;

import java.lang.*;
import java.util.*;
import net.rim.blackberry.api.menuitem.*;
import net.rim.blackberry.api.mail.*;
import net.rim.blackberry.api.pim.*;

//import net.rim.device.api.system.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;

/*
 * MenuItemDemo application
 * This registers a simple menu item with the system to be shown
 * when viewing an email Message. The run method for this menuItem
 * simply gets the message for use
 *
 * Copyright (C) 2003 Research In Motion Ltd.
 */

class MenuItemDemo {

    public static void main(String[] args){
        System.out.println("**** Starting MyMenuItemDemo");
       (new MyMenuItem(0)).registerInstance();
    }
}

class MyMenuItem extends ApplicationMenuItem
{

    // we'll use the default constructors here.
    MyMenuItem(int order){
        super(order);
    }

    // Register the instance of the menuItem with the system
    public void registerInstance(){
        System.out.println("**** Registering MyMenuItemDemo");
        ApplicationMenuItemRepository.getInstance().addMenuItem(ApplicationMenuItemRepository.MENUITEM_ADDRESSBOOK_LIST ,this);
    }

    //methods we must implement
    //Run is called when the menuItem is invokes
    public Object run(Object context)
    {
        Dialog.inform("A followup item has been addded to your Tasks list.");
     
        return context;
    }

    //toString should return the string we want to
    //use as the lable of the menuItem
    public String toString(){
        return "Menu add test";
    }

}

Please use plain text.
Administrator
MSohm
Posts: 14,268
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: MenuItem Test not working

Has your application been signed?  Auto-start applications need to be signed with the RBB key.  You can read more about code signing here:  http://na.blackberry.com/eng/developers/downloads/api.jsp
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
New Developer
XRayCharlie
Posts: 5
Registered: ‎09-15-2008
My Device: Not Specified

Re: MenuItem Test not working

Hello,

 

RBB is signed: 

 

MenuItem.cod Signed Required RBB RIM Blackberry Apps API

 

RCR is also signed with catagory Optional.

 

I also tries the seperate autostart project to no avail.

 

Regards 

Please use plain text.
Administrator
MSohm
Posts: 14,268
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: MenuItem Test not working

So what isn't working?  Do you not see your entry in the menu or does something fail when you click on it?

 

I recommend setting some break points within your application to allow you to step through it and see what is happening.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.