为什么我的 loadUrl 无法工作
我是 android 初学者 我想问为什么如果我使用 loadUrl 并且执行程序总是页面找不到
我的代码:
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class WebViewActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView wv = (WebView) findViewById(R.id.webView1);
WebSettings webSettings = wv.getSettings();
webSettings.setBuiltInZoomControls(true);
String url = "http://ecx.images-amazon.com/images/I/41HGB-W2Z8L._SL500_AA300_.jpg";
wv.loadUrl(url);
}
}
thx before..
i'm beginner in adroid
i want ask why if i used loadUrl and i execute the program always page can't found
this my code:
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;
public class WebViewActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView wv = (WebView) findViewById(R.id.webView1);
WebSettings webSettings = wv.getSettings();
webSettings.setBuiltInZoomControls(true);
String url = "http://ecx.images-amazon.com/images/I/41HGB-W2Z8L._SL500_AA300_.jpg";
wv.loadUrl(url);
}
}
thx before..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在清单文件中添加互联网权限。
它适合您。
you need to add internet permission in manifest file..
<uses-permission android:name="android.permission.INTERNET" />
it's work for you.
它在我的应用程序上运行良好。 99% 确定您忘记在清单中包含 INTERNET 权限。
It works fine on my application. 99% sure you forgot to include the INTERNET permission in your manifest.