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
Trusted Contributor
Posts: 158
Registered: ‎03-09-2010
My Device: 8900
My Carrier: developer
Accepted Solution

regarding ApplicationMeniItem

Hi

 

I had added two menu item in the blackberry Software,whenever i install the Application ,it hangs .

 

when i press Phone disconnected button ,then hang phone Become unhang .

i  want to run the Application normally without hanging .

is there any way ,where application does not hang ,when i load the app in blackberry software ?

 

 

thnks And regards

Amrinder Singh

 

 

Developer
Posts: 101
Registered: ‎07-20-2009
My Device: Not Specified

Re: regarding ApplicationMeniItem

Which event is causing the application to stop responding?

 

Can you please explain the scenario as from your above post, I am not able to understand what is the problem exactly?

Trusted Contributor
Posts: 158
Registered: ‎03-09-2010
My Device: 8900
My Carrier: developer

Re: regarding ApplicationMeniItem

private Class MenuDemo extends UiApplication

{

static MenuDemo theApp = null;

 

public MenuDemo()

{

LMMenu lmm =ApplicationMenuItemRepository.getInstance().

addMenuItem(ApplicationMenuItemRepository.

new LMMenu(0);MENUITEM_ADDRESSBOOK_LIST,lmm);

 

}

 

 

this Code is used for Adding the Application MEnu Item .

 

 

 

thanks And regards

amrinder Singh

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: regarding ApplicationMeniItem

Do you see this problem on the Simulator?

Developer
Posts: 101
Registered: ‎07-20-2009
My Device: Not Specified

Re: regarding ApplicationMeniItem

I guess, you are not pushing any screen from your application, thats why you are not able to see anything after launching the app. Thats why you are getting the not responding behaviour.

 

Also, are you trying to add menu item to Address book application?

Trusted Contributor
Posts: 158
Registered: ‎03-09-2010
My Device: 8900
My Carrier: developer

Re: regarding ApplicationMeniItem

Yes, i see that problem in the simulator .

 

when  i press my application ,then it hangs .when i press disconnected Button phone ,it starts Working and load menu item .

 

it give me the same problem in the bb device as well as in the Simulator .

 

 

i want to load the application without hanging the phone .

 

Thanks and Regards

Amrinder Singh

Trusted Contributor
Posts: 158
Registered: ‎03-09-2010
My Device: 8900
My Carrier: developer

Re: regarding ApplicationMeniItem

This Below Is the Main Class ,where The Event Is calling

 

import net.rim.device.api.ui.UiApplication;
import net.rim.blackberry.api.menuitem.*; // ApplicationMenuItemRepository

 

 

public class MenuDemo extends UiApplication
{
 // one and only instance of application
 static MenuDemo theApp = null;
 // constructor
 public MenuDemo()
 {
  // setup menu(s)
  
  LMMenu lmm = new LMMenu(0);

  ApplicationMenuItemRepository.getInstance().
  
  addMenuItem(ApplicationMenuItemRepository.MENUITEM_ADDRESSBOOK_LIST,lmm);
  
  LMMenu3 lmm1 = new LMMenu3(0);

  ApplicationMenuItemRepository.getInstance().
       
  addMenuItem(ApplicationMenuItemRepository.MENUITEM_SMS_VIEW ,lmm1);

 }

 public static void main(String[] args)
 {
  theApp = new MenuDemo();
  if (theApp != null)
  {
   theApp.enterEventDispatcher();
  }
 }
}

 

 

 

in constructor ,it calls the Class named LMMenu(0).

 

 

 

I able to run the Application ,but after Pressing the disconnected button

 

thanks and regards

amrinder singh

Developer
Posts: 101
Registered: ‎07-20-2009
My Device: Not Specified

Re: regarding ApplicationMeniItem

If your need is just to add the menuitems and come out of application, then you can use requestBackground() method.

Trusted Contributor
Posts: 158
Registered: ‎03-09-2010
My Device: 8900
My Carrier: developer

Re: regarding ApplicationMeniItem

 

 

hi

 

 

i had tried it.method is right of using the  requestBackground(),but at which position i used this method ,cant able to do this .

 

 

thanks and regards

amrinder Singh

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: regarding ApplicationMeniItem

[ Edited ]

Just to emphasise the points already made here by karan127, when you start a UiApplication, the processing expects that you will display a Screen.  In this case you don't.  So you get a white screen.  When you press the 'red' key, the the default processing is to put the current application into the background.  Your application has not stopped, it is just running in the background.  You will see it if you try to switch to another application.

 

You need to think about whether you need an Application or a UiApplication, and whether you want a System module or not.  Your choice will depend on other things that you want to do with your application. 

 

Just putting your application into the background is not a solution, it is just hiding the problem. 

 

And I would also like to point out that this problem has nothing to do with the use of an ApplicationMenuItem.