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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
bb_mamz
Posts: 14
Registered: ‎12-08-2011
My Carrier: developer

Add custom menu item to the File explorer

Hi,

 

I am working on a application which adds menu item to File explorer. I have used the below code and the menu item is getting added to all the folders in the device.

 

  ApplicationMenuItemRepository amir = ApplicationMenuItemRepository.getInstance();        
  amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_BROWSE, this,appDesc);        amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_ITEM, this,appDesc);  
      

But I want the menu item to be visible only for images and document folders only. I have tried specifying multiple mime types but the application is considering only the first mime type given in the application. Below is the sample code which I have tried out:

 

Alernative 1 (separating mime types with comma):

 

  ApplicationMenuItemRepository amir = ApplicationMenuItemRepository.getInstance();        

 amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_BROWSE, this,appDesc,new String[]{"image/*","text/*","application/*"}); //adds menu item to file explorer
       amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_ITEM, this,appDesc,new String[]{"image/*","text/*","application/*"});  
       
       Alternative 2 (separating mime types with semicolon):
          
       amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_BROWSE, this,appDesc,new String("image/*;text/*;application/*")); //adds menu item to file explorer
       amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_ITEM, this,appDesc,new String("image/*;text/*;application/*")); 
       

Alternative 3 (calling multiple addmenuItem methods):


      amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_BROWSE, this,appDesc,new String("text/*")); //adds menu item to file explorer
       amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_ITEM, this,appDesc,new String("text/*")); 
       
        amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_BROWSE, this,appDesc,new String("application/*")); //adds menu item to file explorer
       amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_FILE_EXPLORER_ITEM, this,appDesc,new String("application/*"));  
     

 

Please let me know how to achieve this?

 

Thanks in advance,

Mamatha

Please use plain text.
Contributor
bb_mamz
Posts: 14
Registered: ‎12-08-2011
My Carrier: developer

Re: Add custom menu item to the File explorer

Can anyone help on this please
Please use plain text.