Fetch URL of current page from WebView

后端 未结 1 1221
梦谈多话
梦谈多话 2021-01-27 20:47

I have a link which contains collection of books (for eg. www.bookstore.com), from which I select one book (with URL www.bookstore.com/book1.epub) which should

相关标签:
1条回答
  • 2021-01-27 21:19

    You just need to implement WebViewClient.

    Where inside shouldOverrideUrlLoading(), you will be having current URL:

    @Override  
    public boolean shouldOverrideUrlLoading(WebView view, String url) {  
            // TODO Auto-generated method stub  
    
           // Log.d("URL => ", url);    // current URL
           view.loadUrl(url);  
           return true;  
     }  
    

    Read more about WebView and WebViewClient => WebView | Android Developer

    0 讨论(0)
提交回复
热议问题