2011-07-29 46 views
4
private WebView wv; 
    public void onCreate(Bundle icicle) { 
     super.onCreate(icicle); 
     setContentView(R.layout.infoweblinkview); 

    wv=(WebView) findViewById(R.id.weblinkview); 
    wv.setWebViewClient(new WebViewClient()); 
    wv.getSettings().setJavaScriptEnabled(true); 
    wv.loadUrl(getString(R.string.infourl)); 


wv.setOnClickListener(new OnClickListener() { 

       @Override 
       public void onClick(View v) { 
        // TODO Auto-generated method stub 
        String previousUrl = wv.getUrl(); 
       } 
      }); 

} 

回答

9

的是,您可以覆蓋一些方法你WebViewClient

@Override 
     public void onPageFinished(WebView view, String url) { 
      // TODO Auto-generated method stub 
      super.onPageFinished(view, url); 
     } 

     @Override 
     public boolean shouldOverrideUrlLoading(WebView view, String url) { 
      // TODO Auto-generated method stub 
      return super.shouldOverrideUrlLoading(view, url); 
     } 

     @Override 
     public void onPageStarted(WebView view, String url, Bitmap favicon) { 
      // TODO Auto-generated method stub 
      super.onPageStarted(view, url, favicon); 
     } 

使用任何這種方法按您的要求時,String url給你的網址

+0

感謝您的幫助..我得到了解決方案...謝謝你.. –

相關問題