Eviston
Eviston

Reputation: 31

Click the button to open the URL in the Application

My problem is this, I created a button that calls by clicking a URL page, and when I click it opens the browser. I wish the same to open within the application itself. Can someone help me ?

Main Activity.java

public void btnSite (View View) {

    String url = "http://google.com.br/";
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setData(Uri.parse(url));
    startActivity(i);
}

What setting do I use to open within the application?

Upvotes: 2

Views: 844

Answers (1)

You might want to consider a WebView. See the below for documentation:
https://developer.android.com/reference/android/webkit/WebView.html

There are some limitations on what this'll do though (e.g. in terms of JavaScript and error handling), see the documentation for details and ways to overcome that.

Upvotes: 1

Related Questions