开发者

Android app is not able to open some web pages?

开发者 https://www.devze.com 2023-04-10 14:05 出处:网络
My android app is not able to open some web pages. The same url is working fine in a regular web browser. Thanks for your suggestions.

My android app is not able to open some web pages. The same url is working fine in a regular web browser. Thanks for your suggestions.

Error Msg: **Web Page not available**
The web page at www.talladega.edu might be temporarily down or 

it may have moved permanently to a new web address.

**Here are some suggestions:**
 - Check signal and data connection
 - Reload this page later
 - View a cached copy of the web page from Google

Ple开发者_如何学Pythonase let me know what I am doing wrong. Thanks for your time !

/** 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>


Does your application have permission to access the Internet?

<uses-permission android:name="android.permission.INTERNET" />
0

精彩评论

暂无评论...
验证码 换一张
取 消