简体   繁体   中英

How to call a web page from android without exiting the app

I'm new in Android i need call web page from my app without exiting I try with this code:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.google.es"));
activity.startActivity(intent);

and doesn't work.

Thank for the help!!!

In your xml layout file, use a WebView

<WebView  xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/webView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
/>

If you wish to display a web page from within your app, you will need to create a webview.

Here is good tutorial

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM