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
Highlighted
New Contributor
Posts: 3
Registered: ‎04-17-2010
My Device: Curve 8900
My Carrier: T-Mobile
Accepted Solution

start uiapp from both ribbon and bb app menu

Hi I'm new here - apologies if this is an obvious post

 

I have a gui app developed and working - typical startup  sequence - MyApp Extends UIApplication and the main() method of MyApp creates a new instance of the app and call app.enterEventDisplatcher();

 

within MyApp constructor I create an instance of  MyScreen  which extends MainScreen and implements FocusChangeListener.  so far so normal as I understand it.

 

What I want is to be able to launch my app both from the ribbon screen  and from a menu in the standards BB Calendar app.

 

Question is - how ?

 

I am confused by several different posts/samples on whether I need an alternate entry point or a new app to create the menu items in the standards BB Calendar app.

 

Code samples appreciated - directions needed.

 

Thanks in Advance

 

Ken

 

 

 

 

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: start uiapp from both ribbon and bb app menu

The BB app ribbon only shows "active" applications, i.e. those that are currently running. So your app cannot be "Started" from the ribbon - it must already be running.

 

If you start your app from the home screen icon, and your app gets pushed to background (either because you executed requestBackground() or because a higher-priority app got the focus, like the phone), then your app should show up on the ribbon.  If you click on the icon in the ribbon, your app will get a "requestForeground()" and become the focused app.

 

If you want your icon to appear on the ribbon all of the time, then you'll have to make the app "autostart" in the project properties. Your can code the alternate entry point, or just start a background thread (depends on what your app needs).

 

 

 

 

 

 

 

New Contributor
Posts: 3
Registered: ‎04-17-2010
My Device: Curve 8900
My Carrier: T-Mobile

Re: start uiapp from both ribbon and bb app menu

Thanks RexDoug for the very prompt reply - and on a Saturday evening/Sunday morning ( at least where I am )

 

I'm sure what you say is correct but I guess I have not really made myself clear - I shall have to get used to the language ...  I thought the front screen with the icons on it was called the ribbon - as that's what it used to look like on the older devices.

 

SO to re-phrase my request ....  

 

I have developed a UI  application that I can 'launch' from an icon on the BB front screen.  It is based on the same UI sample code that everyone seems to use.   The user clicks on an icon and a form comes up.  They add data, send it and close the form.  done 

 

Whether this qualifies as 'start' or not I probably don't care - maybe I should but I am not yet that advanced to know what I am missing - baby steps for me thanks.

 

So I now want to place a menu in (say ) a Calendar entry that the user can select and the same form comes up - they enter data, send it etc as before.

 

So is this a separate application and if so how do I 'launch' my existing form/app from that ?

Or is it a separate entry point ?  Do I have to implement a singleton ?

 

I'm looking for some guidance as to the best approach -..

 

Thanks Again

 

Humbly Yours etc ...

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: start uiapp from both ribbon and bb app menu

OK - the "ribbon" is the system app menu that shows up when you select "switch application" from the system menu, or press <alt>ESC on trackball devices, or press and hold the MENU key in 5.0 and later.

 

What you are looking for is accomplished by creating an ApplicationMenuItem, and adding the ApplicationMenuItem to to the ApplicationMenuItemRepository (for the target application).

 

You can add you menu item to the Messages app, calendar, tasks, Maps, etc (most BB apps). When your menu item is selected, the "run" method of the menu item is called, passing a context object. The specific type of object varies from app to app.

 

Of course, you'll want to register the menu items on device startup, so this is where the alternate entry point comes into play. You set up your app to "auto-run", and specify the parameter that is passed on auto-start, so that your app can tell the difference between a system startup and an icon entry. SO you main() will be called twice - once for startup and again when the user clicks on your icon.

 

One other thing to be aware of - when your menu item run() is called, this is calle from the context of the BB app. Because of thread marshalling, this app context will see a different "static" context in your application. You might want to read up on Singletons and Alternate Entry Point before attempting this project. It is complex and is an area that generates a termendous number of threads on this forum.

 

PLease see these articles and also please bookmark the KB for future reference:

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800639/How_to_...

 

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800783/How_To_...

 

 

 

New Contributor
Posts: 3
Registered: ‎04-17-2010
My Device: Curve 8900
My Carrier: T-Mobile

Re: start uiapp from both ribbon and bb app menu

Many many thanks for your patience.

 

This clears up all the confusion - I now have a strategy and some more research to do.

 

 

 

I think I will read up on the application start model - when main gets executed, how app register themselves in the runTiime Store etc ..

 

Thanks again

 

 

Ken