O'Reilly logo

BlackBerry Hacks by Dave Mabe

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #96. Integrate the Browser into a Java App

Combine the richness of a Java client with the extensibility and power of a web backend.

Berry 411 is built using a Java client that launches a web browser. This is a powerful and convenient way to build mobile applications.

The Java client provides instant accessibility from the Home screen and a rich native BlackBerry UI. The browser results screen allows for zero-install deployment of new features, easy display of rich text and graphics, and linking to the expanding array of mobile-friendly web content.

The BlackBerry is especially well suited to building this sort of application. The Back button works as expected when going back from a browser page to the client application that launched it. Using the built-in browser network configuration avoids many of the configuration hassles of direct network access, which requires a number of carrier-specific parameters.

Launch the Browser from Java

In this hack, we'll build an application to do reverse phone number lookups, going from a phone number to a name and address. The Java client displays a titlebar and input field, filtered to limit the user's input to 10 digits. When the user selects Search from the menu (see Figure 9-4), the application launches a web page (in this case, an existing Infospace service) to display the results, shown in Figure 9-5.

Java client

Figure 9-4. Java client

Figure 9-5. Web ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required