O'Reilly logo

Hello, Android, 4th Edition by Ed Burnette

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

Browsing by Intent

The simplest thing you can do with Android’s networking API is to open a browser on a web page of your choice. You might want to do this to provide a link to your home page from your program or to access some server-based application such as an ordering system. In Android all it takes is three lines of code plus a bit of setup.

To demonstrate, let’s write a new example called BrowserIntent, which will have an edit field where you can enter a URL and a Go button you press to open the browser on that URL (see the figure). Start by creating a new “Hello, Android” project with the following values in the New Project wizard:

 
Application name: BrowserIntent
 
Company Domain: example.org
 
Form factors: Phone and Tablet
 
Minimum ...

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