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
Posts: 11
Registered: ‎11-11-2009
My Device: 8800
My Carrier: Airtel
Accepted Solution

Getting Context object null while using the custom menu item.

Hello All,

I have implemented a sample application for adding custom menu item to message list and we are testing this build on Blackberryy 9000 os 5.0.0.411


On the BB 9000 we are having 2 message inbox, A as Blackberry default message inbox and B as the inbox for the email account i have configure on BB 900.
I have implemented custom application menu to add the menu option on the message list.
i can see this option on my both inbox the issue that i am facing is when i am click on the menu item by selecting the email inside the A  Blackberry default message inbox i can get the context object were as when i am click on the same message in side the B inbox i am always get the context object as NULL.

Bellow is the code that i have used to add the custom menu item.

 public static void main(String[] args)
    {
        if(args!=null && args.length > 0){
            // call from alternate entry point. to add menu items mark as Spam and mark as Suspicious.
            if(args[0].equals("gui")){
                try{
                        
                       // create menu items.

                        ApplicationMenuItem mymenu= new EmailFile();
                        // add menu item into Email list and email view.
                        ApplicationMenuItemRepository amir = ApplicationMenuItemRepository.getInstance();
                        amir.addMenuItem( ApplicationMenuItemRepository.MENUITEM_MESSAGE_LIST,  mymenu);
                                }catch(Exception e){
                        Utility.debugLog(e.toString(),CLASSNAME,"main",Utility.EXCEPTION_INFO);
                        System.out.println("Error:"+e.toString());
                    }    
                }else{
                    // show about junk mail application..
        AppMain _theApp = new AppMain();
                    _theApp.enterEventDispatcher();
                }
            }else{
                   // show about junk mail application..
        AppMain _theApp = new AppMain();
                    _theApp.enterEventDispatcher();                
                }
    }

Can any one know what is the problem in my code or some thing that i am missing.

 

Thanks in advance.

Navneet Gupta.

Thanks,
Navneet Gupta.
Highlighted
Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Getting Context object null while using the custom menu item.

application menu items have been buggy for ages. there is nothing you can do except changing your workflow. in some cases you can retrieve the screen of the app and try to extract something from the fields, but its getting more difficult in newer OS versions due to custom fields used by rim.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter