我是新手到android并在webview上做一个演示,我有一个测试网址,我的笔记本电脑浏览器工作正常,我已经在我的网页浏览中设置了它,但它没有加载,它说"网页不可用",请帮我解决,需要帮助,
码
strcpy(c[k], v[k]);
memcpy(c[k], v[k], 1000);
snprintf(c[k], 1000, "%s", v[k]);
// Or
calloc() istead of malloc()
答案 0 :(得分:1)
您需要添加互联网权限
<uses-permission android:name="android.permission.INTERNET"/>
你需要在这里按照我的回答...... Snapchat Url load issue
WebSettings settings = webview.getSettings();
settings.setJavaScriptEnabled(true);
//ws.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webview.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if( url.startsWith("http:") || url.startsWith("https:") ) {
return false;
}
// Log.i(TAG, "Processing webview url click..."+url);
// view.loadUrl(url);
return true;
}
public void onPageFinished(WebView view, String url) {
Log.e(TAG, "Finished loading URL: " + url);
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
}
});
webview.loadUrl("http://rchitecture.in/app1/");