내 안드로이드 앱이 일부 웹 페이지를 열 수 없습니다. 동일한 URL이 일반 웹 브라우저에서 정상적으로 작동합니다. 귀하의 제안에 감사드립니다.Android 앱에서 일부 웹 페이지를 열 수 없습니까?
Error Msg: **Web Page not available**
The web page at www.talladega.edu might be temporarily down or
새 웹 주소로 영구적으로 이동했을 수 있습니다.
**Here are some suggestions:**
- Check signal and data connection
- Reload this page later
- View a cached copy of the web page from Google
내가 뭘 잘못하고 있는지 알려 주시기 바랍니다. 시간 내 줘서 고마워 !
/** Called when the activity is first created. */
**@SuppressWarnings("static-access")**
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
Bundle extras = getIntent().getExtras();
if (extras == null) {
return;
}
pageLink = extras.getString("pageLink");
if (pageLink != null) {
setContentView(R.layout.displayview);
WebView web = (WebView) findViewById(R.id.webview);
web.enablePlatformNotifications();
web.getSettings().setJavaScriptEnabled(true);
web.loadUrl(pageLink);
web.setWebViewClient(new localWebViewClient());
//web.getSettings().setUserAgentString("silly_to_do_this"); --- **do I need to set this ?**
}
}
private class localWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
=== displayview.xml ===
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:background="@color/pageBackGroundColor">
<WebView android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="@color/pageBackGroundColor"
/>
</LinearLayout>
예는 의견에 대해서는 –
도움이 될 : 아니, 당신은'setUserAgentString를 사용할 필요가 없습니다()'가 서버에게 클라이언트에서 사용되는 소프트웨어 및 OS에 대한 정보를 알려주 단지 문자열입니다. 기본 설정은 정상입니다. [User agent] (http://en.wikipedia.org/wiki/User_agent) –