开发者

Intent Filter for Viewing Web Pages

On this page of Android Development, -at step 6- they say :

Instead of adding an intent filter to view web pages, you can override the WebViewClient class and enable this Activity to handle its own URL requests.

But I would like to le开发者_如何学Pythonarn how to do it with intent-filters as well.

I have a WebView widget and a Button widget on my default Activity and when user clicks on the Button, the WebView loads a page - pretty simple. But as it is mentioned in Step-6, I need to enable my Activity to do so.

Can somebody show me intent-filter which does the same things here as WebViewClient - overriding shouldOverrideUrlLoading(WebView view, String url) method.

Thanks in advance.


But I would like to learn how to do it with intent-filters as well.

This is effectively the same thing as a previous question, asked minutes before yours, though they might not seem so on the surface.

You can advertise, via a properly-constructed <data> element in your <intent-filter>, that you can VIEW documents that are text/html. However, the user will be prompted for every link to a Web page they click on anywhere on their phone (plus redirects).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜