BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 03-27-2009, 11:11 AM   #1 (permalink)
New Member
 
Join Date: Jan 2009
Model: 9530
PIN: N/A
Carrier: Verizon
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Programming Menu Key in BlackBerry Storm 9530

Please Login to Remove!

Hi,
I am not sure if this is the right place to post my query.! If not, if someone could guide me, that would be great.

Well, I am developing one App and want it to run on BlackBerry devices. I want to program the MENU KEY available. I am using BlackBerry Storm 9530 for Testing.

Any sample source code would be highly appreciated.

Thanks,
JDK
Offline  
Old 03-27-2009, 12:16 PM   #2 (permalink)
Crimson Tide Moderator
 
JSanders's Avatar
 
Join Date: Oct 2004
Location: North of the moss line
Model: 9xx0
OS: 7.0sumtin
PIN: t low
Carrier: Verizon
Posts: 41,907
Post Thanks: 60
Thanked 244 Times in 182 Posts
Default

**moved the Developer section**
Offline  
Old 03-27-2009, 04:08 PM   #3 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

The menu key is already wired into the makeMenu() method of your screen class, if you are using MainScreen.

If you are doing your own screen, then you'll need to override keyChar() and look for the key Characters.CONTROL_MENU.
Offline  
Old 03-28-2009, 01:54 PM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Nov 2008
Location: Sioux Falls, SD
Model: 9530
PIN: N/A
Carrier: Verizon Wireless
Posts: 65
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dougsg38p is exactly right, here's a code sample for adding your own items to the already existing menu.

Code:
protected void makeMenu(Menu menu, int instance)
{
	MenuItem miPreferences = new MenuItem("Preferences", 2, 0)
	{
		public void run()
		{
			// Code that should be executed when the menu item
			// is selected.
		}
	};

	menu.add(miPreferences);
}
MenuItem JavaDoc.

makeMenu JavaDoc.
__________________
Handspring >> Palm >> BB Pearl >> BB Storm

Tumblog: http://www.geekkink.com
Blog: http://www.zechariahs.org/blog
Offline  
Old 03-30-2009, 01:01 PM   #5 (permalink)
New Member
 
Join Date: Jan 2009
Model: 9530
PIN: N/A
Carrier: Verizon
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Dougsg & zechariahs for your response.

I would like to explain a bit about my work environment.

- I use Netbeans 6.5 IDE
- I already developed my app using LWUIT library and my app runs fine on BlackBerry Storm 9530 device.
- Now I want to add my own menu items created for the LWUIT forms to the default one provided by BlackBerry Storm 9530 on MenuKey click.

Issues I have:
- When I add net_rim_api.jar to my existing project, I get the following error
Quote:
Error preverifying class java.beans.PropertyChangeEvent
java/lang/NoClassDefFoundError: java/util/EventObject
I do not know the solution for this. To avoid this error, I used the whole library path as reference while adding any functionality as below:
item = new net.rim.device.api.ui.MenuItem("Exit", 10000, 10) {

I tried extending from MainScreen and created a LWUIT form in the class. I called super(DEFAULT_MENU | DEFAULT_CLOSE); in the constructor.

But my app never starts... Any guidance on this would be greatly appreciated. This is first time I am into RIM development.

Thanks,
-JDK
Offline  
Old 03-30-2009, 01:33 PM   #6 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

It looks to me like you are importing core Java SE components into your project. These are not supported in the JME environment.

Since you are new to BB Development, and since the NetBeans environment is not really supported by RIM (and not widely used, so you won't find much help with it), I suggest that you either (a) switch to the RIM JDE, or (b) switch to Eclipse.
Offline  
Old 03-30-2009, 01:56 PM   #7 (permalink)
New Member
 
Join Date: Jan 2009
Model: 9530
PIN: N/A
Carrier: Verizon
Posts: 10
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Dougsg,
Thanks for your prompt response.

I do not use any Java SE stuff in my app. I use the below libraries:

import javax.microedition.midlet.*;
import com.sun.lwuit.*;

That's it. I do not understand why I still get the above errors.!

Thanks,
JDK
Offline  
Old 03-30-2009, 07:02 PM   #8 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

java.util.EventObject is not part of the RIM api's - nor is PropertyChangeEvent.

You need to run the preverify tool on that lwuit library.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.