Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Goto HTTP Url on Button Click

Tags:

I want to go to a web page on the click of a button in my Android app. So say, I have a button called "Google", when the user clicks on that button I want google.com to open up on the screen. How is this achieved?

Also, is there a way I can gain control back to my app once the user is finished with Google?

like image 661
Chris Avatar asked May 04 '10 04:05

Chris


1 Answers

In your activity do something like this.

public void openWebURL( String inURL ) {     Intent browse = new Intent( Intent.ACTION_VIEW , Uri.parse( inURL ) );      startActivity( browse ); } 

By default, quitting the browser should return to your activity. However, there may be situations where it will not.

like image 186
drawnonward Avatar answered Oct 12 '22 14:10

drawnonward