BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 03-27-2009, 10:11 AM   #1
sojourner_jdk
New Member
 
Join Date: Jan 2009
Model: 9530
PIN: N/A
Carrier: Verizon
Posts: 10
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, 11:16 AM   #2
JSanders
Crimson Tide Moderator
 
JSanders's Avatar
 
Join Date: Oct 2004
Location: North of the moss line
Model: Z30
OS: 7.0sumtin
PIN: t low
Carrier: Verizon
Posts: 41,921
Default

**moved the Developer section**
Offline  
Old 03-27-2009, 03:08 PM   #3
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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, 12:54 PM   #4
zechariahs
Thumbs Must Hurt
 
Join Date: Nov 2008
Location: Sioux Falls, SD
Model: 9530
PIN: N/A
Carrier: Verizon Wireless
Posts: 65
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, 12:01 PM   #5
sojourner_jdk
New Member
 
Join Date: Jan 2009
Model: 9530
PIN: N/A
Carrier: Verizon
Posts: 10
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, 12:33 PM   #6
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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, 12:56 PM   #7
sojourner_jdk
New Member
 
Join Date: Jan 2009
Model: 9530
PIN: N/A
Carrier: Verizon
Posts: 10
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, 06:02 PM   #8
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
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



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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


MSA 10042621 Altair 5X Sampling Probe Straight Air-Line 1' Color Black (E2) picture

MSA 10042621 Altair 5X Sampling Probe Straight Air-Line 1' Color Black (E2)

$295.00



Altair WBS-202 Dual channel wireless intercom base station picture

Altair WBS-202 Dual channel wireless intercom base station

$1350.00



🔅MSA altair 4X multi gas Meter Monitor detector, (O2,H2S,CO,LEL) & Charger picture

🔅MSA altair 4X multi gas Meter Monitor detector, (O2,H2S,CO,LEL) & Charger

$399.99



MSA Safety 10087913 Charger for Altair 4X and 5X Multi-Gas Detector picture

MSA Safety 10087913 Charger for Altair 4X and 5X Multi-Gas Detector

$56.00



MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated picture

MSA altair 4X multi gas meter Monitor detector, O2,H2S,CO,LEL Charger calibrated

$450.00



MSA 10106725 Sensor with Alarms 10/1700 ppm with Altair 4X/5X Multi-Gas Detector picture

MSA 10106725 Sensor with Alarms 10/1700 ppm with Altair 4X/5X Multi-Gas Detector

$199.00







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