简体   繁体   English

如何在不退出应用程序的情况下从android调用网页

[英]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: 我是Android的新手,我需要从我的应用程序调用网页而不退出,请尝试使用以下代码:

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 在您的xml布局文件中,使用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. 如果要在应用程序中显示网页,则需要创建一个Webview。

Here is good tutorial 这是很好的教程

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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