1. Download our Official Android App: Forums for Android!

Apps webpage not available

Discussion in 'Android Development' started by currycrab, Sep 12, 2011.

  1. currycrab

    currycrab Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    31
    Joined:
    Sep 11, 2011

    Sep 11, 2011
    31
    0
    15
    programming student
    somewhere
    hi,
    i have encountered another problem again. this time with the webview.

    doesnt know why webview dosent display the page even thou the website is working fine on my computer browser.

    do i need to put some permission in my manifest.xml or sumthing?

    Code (Text):
    1. package com.web;
    2.  
    3. import android.app.Activity;
    4. import android.os.Bundle;
    5. import android.view.Window;
    6. import android.webkit.WebChromeClient;
    7. import android.webkit.WebView;
    8. import android.webkit.WebViewClient;
    9.  
    10. public class ZZZwebActivity extends Activity {
    11.     final Activity activity = this;
    12.      
    13.     @Override
    14.     public void onCreate(Bundle savedInstanceState)
    15.     {
    16.         super.onCreate(savedInstanceState);
    17.         this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
    18.         setContentView(R.layout.main);
    19.         WebView webView = (WebView) findViewById(R.id.webview);
    20.         webView.getSettings().setJavaScriptEnabled(true);
    21.  
    22.         webView.setWebChromeClient(new WebChromeClient() {
    23.             public void onProgressChanged(WebView view, int progress)
    24.             {
    25.                 activity.setTitle("Loading...");
    26.                 activity.setProgress(progress * 100);
    27.  
    28.                 if(progress == 100)
    29.                     activity.setTitle(R.string.app_name);
    30.             }
    31.         });
    32.  
    33.         webView.setWebViewClient(new WebViewClient() {
    34.             @Override
    35.             public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
    36.             {
    37.                 // Handle the error
    38.             }
    39.  
    40.             @Override
    41.             public boolean shouldOverrideUrlLoading(WebView view, String url)
    42.             {
    43.                 view.loadUrl(url);
    44.                 return true;
    45.             }
    46.         });
    47.  
    48.         webView.loadUrl("www.google.com");
    49.     }
    50. }
    :(:(:(:(
     

    Advertisement

  2. qasimValent

    qasimValent Newbie
    Rank:
    None
    Points:
    16
    Posts:
    39
    Joined:
    Jun 29, 2010

    Jun 29, 2010
    39
    6
    16
    RG
    Make sure you have tthe uses internet permission
    <uses-permission android:name="android.permission.INTERNET" />

    If that ddoesnt work report back
     
  3. currycrab

    currycrab Newbie
    Thread Starter
    Rank:
    None
    Points:
    15
    Posts:
    31
    Joined:
    Sep 11, 2011

    Sep 11, 2011
    31
    0
    15
    programming student
    somewhere
    yeah. that works. manage to found the solution on the internet. thanks alot anyway. sorry nv reply here.
     

Share This Page

Loading...