BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 11-24-2008, 01:35 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2008
Model: 8100
PIN: N/A
Carrier: AT&T
Posts: 30
Post Thanks: 0
Thanked 0 Times in 0 Posts
Question ApplicationMenuItem duplicated several times

Please Login to Remove!

My Application constructor adds an ApplicationMenuItem to one of the phone menus

the problem is that every time I open and close the application the same MenuItem is added multiple times

how to I make sure a menu item is only created once per application?
Offline  
Old 11-24-2008, 04:08 AM   #2 (permalink)
CrackBerry Addict
 
Join Date: Apr 2005
Location: hamburg, germany
Model: 8900
Carrier: o2
Posts: 838
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

you could add the menuitem in an autostart part of the application.
or you can put an instance of the menuitem into the runtimestore and check for it.
__________________
java developer, Devinto, hamburg/germany
Offline  
Old 11-24-2008, 04:56 PM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2008
Model: 8100
PIN: N/A
Carrier: AT&T
Posts: 30
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Do you have a code example of these two methods?
Offline  
Old 11-25-2008, 03:40 AM   #4 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

why not simply removing your menuitem on application getting closed? On the next start it will be aded again.
__________________
Blessed is the end user who expects nothing, for he/she will not be disappointed. (Franklin's Rule)
Offline  
Old 11-25-2008, 03:28 PM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2008
Model: 8100
PIN: N/A
Carrier: AT&T
Posts: 30
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

How do I remove a specific menu item?

Can you show code example?
Offline  
Old 11-25-2008, 03:54 PM   #6 (permalink)
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

like adding it...

use removeMenuItem(long id, ApplicationMenuItem item) from ApplicationMenuItemRepository
__________________
Blessed is the end user who expects nothing, for he/she will not be disappointed. (Franklin's Rule)
Offline  




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