Guide de développement

Local Navigation

Provide an alternate entry point for your application

Your application must detect when the BlackBerry device activates it using an alternate entry point. The following steps demonstrate how to enable an application to accept an alternate entry point for a UiAction object.
Before you begin: Configure an alternate entry point for your application. For more information about declaring an alternate entry point in your project, see Specify the alternate entry point settings for a BlackBerry application project.
  1. Import the required classes and interfaces.
    import net.rim.device.api.ui.UiApplication;
  2. Create the application framework by extending the UiApplication class.
    public class MyApp extends UiApplication
    {
        public static void main(args[])
        {
        }
    
        public MyApp(String entryPoint)
        {
        }
    }
  3. In the main() method, indentify whether a user launched the application from the Home screen of a BlackBerry device, or through a search result. This step assumes that you configured an alternate entry point for your project named uiAction.
    if( args != null && args.length > 0 && args[0].equals("uiAction"))
    {
  4. Create an application object. Provide the entry point type as a parameter.
        app = new MyApp("uiAction");
    } else
    {
        app = new MyApp("user");
    }
  5. Start your application.
    app.enterEventDispatcher;
  6. In your application constructor, indentify the entry point used to launch the application.
    if(entryPoint.equals("normal")
    {
  7. If the your appilcation was launched from the Home screen, display your first screen.
    {
        pushScreen(new MyAppScreen());
  8. If a user launched your application from a search result, do nothing. The application that provided the search result prompts your application to execute the UiAction automatically.
    } else
    {
    }

Was this information helpful? Send us your comments.